Usage of Display business rule with Client script

ramkrish
Kilo Contributor

Hi,

Can Display business rule be used alone or it has to be used always with g_scratchpad variable in it and corresponding onLoad client script to call the scratchpad variable?

can you help here?

Regards.

10 REPLIES 10

anjalichoudhary
Kilo Guru

Hi Rama,



Display Business Rules execute their logic when a form loads and a record is loaded from the database. They must complete execution before control of the form is given to a user. The purpose of a display Business Rule is to populate an automatically instantiated object, g_scratchpad. The g_scratchpad object is passed from the display Business Rule to the client-side for use by client-side scripts. Recall that when scripting on the client-side, scripts only have access to fields and field values for fields on the form and not all of the fields from the database. Use the g_scratchpad object to pass data to the client-side without modifying the form. The g_scratchpad object has no default properties.



Below links will help you to understand more!!



Display business-rules



example use of display business rule



Hope it helps!!



Regards,


Anjali


sharma_sha
Tera Contributor

Yes,Display business rule can be used alone too. The value of variables get stored into scratchpad which you can store that into another variables.


For further info I am sharing the link:Using the Workflow Scratchpad - ServiceNow Wiki


Hi Shashasnk,



The business rule storing any variable is of no use until its called by an client script. So, what would be the point of using the g_scratchpad in BR if its not utilized.




Regards,




Shariq