Oracle CRM On Demand JavaScript API Developer's Guide > JavaScript API Code Samples >

Code Sample for Changing the Behavior of a Save Button


The following code customizes the Save button on the Account Edit page so that the code changes the owner of the record:

oraclecrmod.onReady(

function(){

if(oraclecrmod.ctx.isObject("Account") && oraclecrmod.ctx.isEditPage()){

var btnSave = oraclecrmod.getButton("BTN_TB_AccountEditForm_Save");

if(btnSave != null){

btnSave.offAll("click").on("click",function(){

//set on screen value api to set the value.

oraclecrmod.getField('Owner Alias').setValue("User1");

btnSave.invokeDefault("click");

});

}

}

});

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