Bookshelf Home | Contents | Index | PDF |
Oracle CRM On Demand JavaScript API Developer's Guide > JavaScript API Code Samples > Code Sample for Color Coding of Fields and RowsThe following code sets colors on pages as follows:
//color function for coloring the Opp detail/edit page //on the Opportunity detail/edit page, change the color for the Probability field depending on the percentage entered var percent= oraclecrmod.getField("Primary Revenue Win Probability"); //color function for coloring the Opp List var percent= row.getField("Primary Revenue Win Probability"); var priority = row.getField("Priority"); //set the row to Yellow in the list if the priority is High if (priority.getValue()=="High") row.setColor({rowBgColor:"yellow"}); row.setColor({rowBgColor:""}); //this clears previous set color and will display based on theme color //common color function to color the Probability field in the same way in the list page as it is colored on the detail/edit page function colorPercent(percent) var myblue = "rgb(66,97,156)"; var myyellow= "rgb(255,215,181)"; percent.setColor({"labelBgColor":myred,"labelTextColor":myblue,"valueBgColor":myblue,"valueTextColor":myred}); percent.setColor({"labelBgColor":"","labelTextColor":"","valueBgColor":"","valueTextColor":""}); //this clears previous set color and will display based on theme color //color function for coloring the Opp's Contact Child List function colorOpptyContactChildList(row) var role = row.getField("Role"); //set the row to Cyan in the list if the contact's role is Decision maker //change text of role to Red as well if (role.getValue()=="Decision Maker") row.setColor({rowBgColor:"cyan"}); role.setColor({valueTextColor:"Red"}); row.setColor({rowBgColor:""}); //this clears previous set color and will display based on theme color role.setColor({valueTextColor:""}); //this clears previous set color and will display based on theme color // entry point for running custom code oraclecrmod.onReady(function() //if Name field exists on the form, then set the field label background to Black, field label text to Red, value background to red and value text to black //for example, this applies to Account Name on Account detail/edit page and Opportunity Name on Opportunity detail/edit page var name = oraclecrmod.getField("Name"); if (name != null) name.setColor({"labelBgColor": "Black","labelTextColor":"#ff0000","valueBgColor": "#ff0000","valueTextColor":"Black"}); //get the form on the page for Opportunity if(oraclecrmod.ctx.object == "Opportunity") //for the opportunity list page if (oraclecrmod.ctx.isListPage()) var oppList = oraclecrmod.getList(); if (oraclecrmod.getForm() != null) oraclecrmod.getForm().on("display", colorOppty); //set the custom function to run on display of the form
var contactList = oraclecrmod.getList("ContactRoleChildList"); |
Oracle CRM On Demand JavaScript API Developer's Guide, Release 34 | Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |