executeDelete(DARequest)
This function is used to delete existing records from the local offline database including attachments.
• Function Signature: executeDelete(DARequest)
• Function Name: executeDelete
• Parameter: DARequest
• Sample Code:
DARequest objDAReq = new DARequest();
objDAReq.UserName = "tech@acme.com";
objDAReq.APIKey = "LVaNcHj01asdLX10bBxst2hC6AbsEaWSQSxpknfCjaJ8GKYIa9ZD66++8VYXXxqL";
objDAReq.ObjectName = "Account";
ArrayList arrFD = new ArrayList();
FieldData objFD = new FieldData();
objFD.setName = ("Name");
objFD.setValue = ("Burlingame");
objFD.setType = ("string");
arrFD.Add(objFD);
objFD = new FieldData();
objFD.setName = ("Type");
objFD.setValue = ("Other");
objFD.setType = ("picklist");
arrFD.Add(objFD);
objFD = new FieldData();
objFD.setName = ("BillingStreet");
objFD.setValue = ("Main Street");
objFD.setType = ("textarea");
arrFD.Add(objFD);
objDAReq.FieldNames = arrFD;
ArrayList arrCD = new ArrayList();
CriteriaData objCD = new CriteriaData();
objCD.setName = "Id";
objCD.setValue = "1";
objCD.setOperator = "=";
arrCD.Add(objCD);
objCD = new CriteriaData();
objCD.setName = "OwnerId";
objCD.setValue = "3";
objCD.setOperator = "=";
arrCD.Add(objCD);
objDAReq.AdvanceExpression = "1 AND 2";
objDAReq.Criteria = arrCD;
LaptopMobile.DataAccessAPI.DataAccessAPI objDAAPI = new LaptopMobile.DataAccessAPI.DataAccessAPI();
objDAAPI.executeDelete(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":"Account",
"Response Code":0,
"Response Message":"ERR-010: Error updating records. Data type mismatch.",
"Error Id":"ERR-010",
"Error Message":"ERR-010: Error updating records. Data type mismatch.",
"Error Description":"",
"Stack Trace":""
}
Sample Failure response:
{
"Object Name":"Account",
"Response Code":0,
"Response Message":"ERR-006: Error deleting records. Permission denied. Verify object and field level permissions.",
"Error Id":"ERR-006",
"Error Message":"ERR-006: Error deleting records. Permission denied. Verify object and field level permissions.",
"Error Description":"",
"Stack Trace":""
}
• Multiple records can be deleted using appropriate criteria.
• For attachments Delete, typical criteria may be based on Name of the file (name field) and Parent_id field.