Difference between revisions of "DeleteRecord"
From AgileApps Support Wiki
imported>Aeric |
imported>Aeric |
||
Line 5: | Line 5: | ||
:<syntaxhighlight lang="java" enclose="div"> | :<syntaxhighlight lang="java" enclose="div"> | ||
Result result = Functions.deleteRecord(String objectName, String recordID); | Result result = Functions.deleteRecord(String objectName, String recordID); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 12: | Line 11: | ||
:;recordID:The identifier of the record to delete. | :;recordID:The identifier of the record to delete. | ||
;Return:[[Result Class|<tt>Result</tt> object]] | ;Return:[[Result Class|<tt>Result</tt> object]] |
Revision as of 02:21, 12 January 2013
Delete a record.
Syntax
- <syntaxhighlight lang="java" enclose="div">
Result result = Functions.deleteRecord(String objectName, String recordID); </syntaxhighlight>
Parameters
- objectName
- The object name or identifier
- recordID
- The identifier of the record to delete.
- 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.
- <syntaxhighlight lang="java" enclose="div">
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.
} </syntaxhighlight>