Oracle CRM On Demand JavaScript API Developer's Guide > Overview of the JavaScript API > Overview of Customizing Buttons >

Changing the Behavior of Buttons


The JavaScript API enables you to specify the onclick event handling for a custom button or modify the onclick event handling of a custom button or preconfigured button (such as New, Save, and Cancel), and thereby change its behavior.

You can change the click event handling of custom and preconfigured buttons to do the following:

  • Set or retrieve on-screen values.
  • Create, read, update, and delete (CRUD) off-screen records.

For information about registering and removing event handlers, see Methods for the Button Object and Defining an Event Handler for a Button.

Getting and Setting On-Screen Values

You can use getter and setter methods to retrieve and set the values of fields on the current page when a user clicks a button. For all fields, language dependent code (LDC) values are retrieved, however for picklists, there are also additional getter and setter methods to retrieve and set language independent code (LIC) values. For information about these methods, see Methods for the Field Object and Getting and Setting LIC Values of Picklists.

Creating, Reading, Updating, and Deleting Records

You can use methods to perform the following operations on off-screen records when you click a button:

  • Create record. You can create a record and specify the record type, its fields, and their values.
  • Read record. You can retrieve the fields from a record. You can specify the record type, record row ID, and a list of field names to be returned with their values.
  • Update record. You can update a record identified with a specific row ID. You can specify the field names and values to update the record.
  • Delete record. You can delete a record identified with a specific row ID.

For all of these create, read, update, and delete (CRUD) operations, you must have access to the record. If you do not, then the operation fails. You must implement a callback function to handle the results of the CRUD operation, when they become available. For information about the CRUD methods, see Methods for CRUD Operations.

NOTE:  For the CRUD operations, only top-level record types and not child-level record types are supported.

TIP:   Use the Oracle CRM On Demand REST API for data manipulation with off-screen records. The REST API is more powerful for data manipulation of off-screen records and it has more functionality such as support for CRUD operations on child-level record types. For more information, see Oracle CRM On Demand REST API Developer's Guide.

Oracle CRM On Demand JavaScript API Developer's Guide, Release 38 Copyright © 2019, Oracle and/or its affiliates. All rights reserved. Legal Notices.