getDBObjectFields (DARequest)
This function is used to get the list of fields for a given object from the local offline database with its permissions and data type.
Function Signature: getDBObjectFields(DARequest)
Function Name: getDBObjectFields
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.getDBObjectFields(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-001: Field information for the given object retrieved successfully.",
"Output": [
{"local_id":2100,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"Id",
"label":"Record ID",
"precision":0,
"scale":0,
"length":18,
"type":"id",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2101,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"OwnerId",
"label":"Owner ID",
"precision":0,
"scale":0,
"length":18,
"type":"reference",
"reference_to":"User",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"Owner",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2102,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"IsDeleted",
"label":"Deleted",
"precision":0,
"scale":0,
"length":0,
"type":"boolean",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2103,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"Name",
"label":"Work Order Number",
"precision":0,
"scale":0,
"length":80,
"type":"string",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2104,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"CurrencyIsoCode",
"label":"Currency ISO Code",
"precision":0,
"scale":0,
"length":3,
"type":"picklist",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2105,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"RecordTypeId",
"label":"Record Type ID",
"precision":0,
"scale":0,
"length":18,
"type":"reference",
"reference_to":"RecordType",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"RecordType",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2106,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"CreatedDate",
"label":"Created Date",
"precision":0,
"scale":0,
"length":0,
"type":"datetime",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2107,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"CreatedById",
"label":"Created By ID",
"precision":0,
"scale":0,
"length":18,
"type":"reference",
"reference_to":"User",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"CreatedBy",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2108,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"LastModifiedDate",
"label":"Last Modified Date",
"precision":0,
"scale":0,
"length":0,
"type":"datetime",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2109,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"LastModifiedById",
"label":"Last Modified By ID",
"precision":0,
"scale":0,
"length":18,
"type":"reference",
"reference_to":"User",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"LastModifiedBy",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2110,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"SystemModstamp",
"label":"System Modstamp",
"precision":0,
"scale":0,
"length":0,
"type":"datetime",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2111,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"LastActivityDate",
"label":"Last Activity Date",
"precision":0,
"scale":0,
"length":0,
"type":"date",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2112,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"LastViewedDate",
"label":"Last Viewed Date",
"precision":0,
"scale":0,
"length":0,
"type":"datetime",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
},
{
"local_id":2113,
"object_api_name":"SVMXC__Service_Order__c",
"api_name":"LastReferencedDate",
"label":"Last Referenced Date",
"precision":0,
"scale":0,
"length":0,
"type":"datetime",
"reference_to":"",
"nillable":false,
"unique":false,
"restricted_picklist":false,
"calculated":false,
"defaulted_on_create":false,
"name_field":false,
"relationship_name":"",
"dependent_picklist":false,
"controler_field":""
}
],
"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":""
}
Salesforce Files are supported for ServiceMax Laptop Data Access API, if the Global Setting GBL037 is set to true. For more information, see Salesforce Files. The API structure to insert or delete Salesforce Files remains the same as attachments.
Was this helpful?