AgileApps Support Wiki Pre Release

Difference between revisions of "DeleteRecord"

From AgileApps Support Wiki
imported>Aeric
 
imported>Aeric
Line 15: Line 15:
:;params:
:;params:
::* Typically, a parameters argument is not specified.
::* Typically, a parameters argument is not specified.
::* When needed, it can be used to add the [[#Data Policy Bypass Parameter|Data Policy Bypass Parameter]], on order to bypass data policies defined in the platform for this operation.
:::<syntaxhighlight lang="java" enclose="div">
params.add(PLATFORM.PARAMS.RECORD.DO_NOT_EXEC_DATA_POLICY,"1");
</syntaxhighlight>


;Return:[[Result Class|<tt>Result</tt> object]]
;Return:[[Result Class|<tt>Result</tt> object]]

Revision as of 23:38, 29 June 2011

Delete a record.

Syntax

Result result = Functions.deleteRecord(String objectID, String recordID);
Result result = Functions.deleteRecord(String objectID, String recordID, Parameters params);

Parameters

objectID
The identifier of the object.
recordID
The identifier of the record to delete.
params
  • Typically, a parameters argument is not specified.
Return
Result object
Example
This example calls deleteRecord, assigning the returned value to an instance of Result and calling Result.getCode to assign the error code to a variable which is then conditionally checked to determine the code to execute. If the call was not successful, the code calls throwError to display an error dialog.
String accountID = "";
// Some logic to populate accountID variable.
Result result = Functions.deleteRecord("ACCOUNT", accountID);
int resultCode = result.getCode();
if(resultCode < 0)
{
    // Some error happened.
    String msg = "Account could not be deleted";
    Functions.debug(msg + ":\n" + result.getMessage());  // Log details
    Functions.throwError(msg + ".");                     // Error dialog
}
else 
{
    // Take other actions on successful addition
    // of the account.
}