getDbObjects(DARequest)
This function is used to get the list of objects the user is allowed for the CRUD operation from the local offline database.
• Function Signature: getDbObjects(DARequest)
• Function Name: getDbObjects
• Parameter: DARequest
• Sample Code:
DARequest objDAReq = new DARequest();
objDAReq.UserName = "tech@acme.com";
objDAReq.APIKey = "LVaNcHj01asdLX10bBxst2hC6AbsEaWSQSxpknfCjaJ8GKYIa9ZD66++8VYXXxqL";
objDAReq.ObjectName = "SVMXC__Service_Order__c";
ArrayList arrFD = new ArrayList();
FieldData objFD = new FieldData();
objFD.setName = "*";
arrFD.Add(objFD);
objDAReq.FieldNames = arrFD;
LaptopMobile.DataAccessAPI.DataAccessAPI objDAAPI = new LaptopMobile.DataAccessAPI.DataAccessAPI();
objDAAPI.getDbObjects(objDAReq);
if (objDAReq.DAResponse.responseCode == 1)
{
System.Diagnostics.Debug.WriteLine("Response: " + objDAReq.Response);
}
else
{
System.Diagnostics.Debug.WriteLine("Failure Response: " + objDAReq.Response);
}
Sample Success response:
{
"Object Name":"SVMXC__Service_Order__c",
"Response Code":1,
"Response Message":"MSG-002: Object information for the given object retrieved successfully.",
"Output": [
{"local_id":"69",
"object_name":"SVMXC__Service_Order__c",
"object_describe": {
"fields": [
{"autoNumber":false,
"calculated":false,
"controllerName":null,
"createable":false,
"defaultedOnCreate":true,
"dependentPicklist":false,
"label":"Record ID",
"length":18,
"name":"Id",
"nameField":false,
"nillable":false,
"picklistValues": [
],
"precision":0,
"referenceTo": [
],
"relationshipName":null,
"scale":0,
"type":"id",
"updateable":false,
"unique":false
},
{
"autoNumber":false,
"calculated":false,
"controllerName":null,
"createable":true,
"defaultedOnCreate":true,
"dependentPicklist":false,
"label":"Owner ID",
"length":18,
"name":"OwnerId",
"nameField":false,
"nillable":false,
"picklistValues": [
],
"precision":0,
"referenceTo": [
"Group",
"User"
],
"relationshipName":"Owner",
"scale":0,
"type":"reference",
"updateable":true,
"unique":false
},
{
"autoNumber":false,
"calculated":false,
"controllerName":null,
"createable":false,
"defaultedOnCreate":true,
"dependentPicklist":false,
"label":"Deleted",
"length":0,
"name":"IsDeleted",
"nameField":false,
"nillable":false,
"picklistValues": [
],
"precision":0,
"referenceTo": [
],
"relationshipName":null,
"scale":0,
"type":"boolean",
"updateable":false,
"unique":false
}
],
"recordTypeInfos": [
{"available":true,
"defaultRecordTypeMapping":false,
"master":false,
"name":"Field Service",
"recordTypeId":"0120R000000VVl9QAG",
"urls": {
"layout":"/services/data/v38.0/sobjects/SVMXC__Service_Order__c/describe/layouts/0120R000000VVl9QAG"
}
},
{
"available":true,
"defaultRecordTypeMapping":false,
"master":false,
"name":"RT 002",
"recordTypeId":"0120R000000V0TkQAK",
"urls": {
"layout":"/services/data/v38.0/sobjects/SVMXC__Service_Order__c/describe/layouts/0120R000000V0TkQAK"
}
}
],
"label":"Work Order",
"keyPrefix":"a1y",
"name":"SVMXC__Service_Order__c",
"labelPlural":"Work Orders",
"createable":true,
"updateable":true,
"deletable":true,
"queryable":true,
"childRelationships": [
{"cascadeDelete":true,
"childSObject":"ActivityHistory",
"deprecatedAndHidden":false,
"field":"WhatId",
"junctionIdListNames": [
],
"junctionReferenceTo": [
],
"relationshipName":"ActivityHistories",
"restrictedDelete":false
},
{
"cascadeDelete":true,
"childSObject":"AssistantRecommendation",
"deprecatedAndHidden":false,
"field":"RecordId",
"junctionIdListNames": [
],
"junctionReferenceTo": [
],
"relationshipName":null,
"restrictedDelete":false
}
]
},
"key_prefix":"a1y",
"label":"Work Order"
}
],
"Error Id":"",
"Error Message":"",
"Error Description":"",
"Stack Trace":""
}
Sample Failure response:
{
"Object Name":"SVMXC__Service_Order__c",
"Response Code":0,
"Response Message":"ERR-012: Error accessing Laptop Mobile through API. Permission denied. Verify user level permissions.",
"Error Id":"ERR-012",
"Error Message":"ERR-012: Error accessing Laptop Mobile through API. Permission denied. Verify user level permissions.",
"Error Description":"",
"Stack Trace":""
}