Oracle CRM On Demand JavaScript API Developer's Guide > JavaScript API Reference > Methods for CRUD Operations >

User-Defined Callback Function


You can use a callback function to handle responses to CRUD operations, as shown in Table 12.

Table 12. Callback Function for CRUD Operations
Method Name
Description
Sample Code

Callback function name

callback (request, response)

User-defined JavaScript function to process the results of the CRUD operations.

callback(request,response)

{

}

The parameters for a callback function are as follows:

  • request. The request object containing the command, row ID, and other field objects passed in the initial request.
  • response. The response object containing the result of the CRUD operation. The object properties are as follows:
    • status. The status of the request, which is either OK or ERROR.
    • data. The name-value pair of the fields whose values are returned (fieldNameValuePairs). For example:

    Name="Account Test", Location="Account Location", Type="Competitor"

    • errors. Any error returned, which can be null or an error object.
    • helper function. The name of a helper function, for example, getRowId(), getModId(). For more information, see Helper Functions for Callback Functions.
Oracle CRM On Demand JavaScript API Developer's Guide, Release 38 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Legal Notices.