executeQuery(DARequest)
This function is used to query existing records from the local offline database including attachments.
Function Signature: executeQuery(DARequest)
Function Name: executeQuery
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 = "Id";
arrFD.Add(objFD);

objFD = new FieldData();
objFD.setName = "Name";
arrFD.Add(objFD);

objDAReq.FieldNames = arrFD;

ArrayList arrCD = new ArrayList();

CriteriaData objCD = new CriteriaData();
objCD.setName = "SVMXC__Order_Status__c";
objCD.setValue = "Open";
objCD.setOperator = "=";

arrCD.Add(objCD);

objCD = new CriteriaData();
objCD.setName = "SVMXC__Billing_Type__c";
objCD.setValue = "Contract";
objCD.setOperator = "=";
arrCD.Add(objCD);

objDAReq.AdvanceExpression = "1 AND 2";
objDAReq.Criteria = arrCD;
objDAReq.OrderBy = "Name DESC";

LaptopMobile.DataAccessAPI.DataAccessAPI objDAAPI = new LaptopMobile.DataAccessAPI.DataAccessAPI();

objDAAPI.executeQuery(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-006: Record(s) retrieved successfully. Number of rows queried: 4",
"Output": [
{"Id":"a1y0R000000ZLWiQAO",
"Name":"WO-00000757"
},
{
"Id":"a1y0R000000ZKCUQA4",
"Name":"WO-00000756"
},
{
"Id":"a1y0R000000T5uCQAS",
"Name":"WO-00000633"
},
{
"Id":"a1y0R000000TYLDQA4",
"Name":"WO-00000567"
}
],
"Error Id":"",
"Error Message":"",
"Error Description":"",
"Stack Trace":""
}
Sample Failure response:
{
"Object Name":"SVMXC__Service_Order__c",
"Response Code":0,
"Response Message":"ERR-005: Error querying records. Permission denied. Verify object level permission.",
"Error Id":"ERR-005",
"Error Message":"ERR-005: Error querying records. Permission denied. Verify object level permission.",
"Error Description":"",
"Stack Trace":""
}
For Attachments query:
The destination location should be valid and accessible.
Multiple records can be retrieved using appropriate criteria. The typical criteria may be based on name, parent_id, and description fields.
Was this helpful?