Oracle CRM On Demand JavaScript API Developer's Guide > JavaScript API Reference > Methods for the Form Object >

Example of a Custom Handler for a Form Object


The following is a pseudocode example of a custom handler for a Form object. The example includes an RGB value (rgb(255,255,0)) for the field value background color of yellow, and a hexadecimal value (#ff0000) for the field value text color of red.

function myColorHandler()

{

var accountValue = oraclecrmod.getField("AccountValue").getValue();

var field = oraclecrmod.getField("AccountName");

if (accountvalue>1000000) then

{

field.setColor({"labelBgColor":"Red","labelTextColor":"Yellow",

"valueBgColor":"rgb(255,255,0)","valueTextColor":"#ff0000"});

}

else {

field.setColor({"labelBgColor":"","labelTextColor":"",

"valueBgColor":"","valueTextColor":""});

}

}

//set up the color handler

oraclecrmod.getForm().on("display",myColorHandler)

For a full code sample, see Code Sample for Color Coding of Fields and Rows.

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