Passing values to the client side

Sometimes, you may want to pass values to the client side because they will not be visible on the loaded form, and these values may be useful for running client scripts. In this instance, you will want to use a display business rule. This allows scratchpad values to be set in the display business rule, which can then be used in client-side script on the form.

If you are considering calling the server from an onLoad client script, then it is usually better to use a display business rule instead, as this eliminates the need for an extra call to the server.

We can see what a display business rule looks like in Figure 5.4:

Figure 5.4: Display business rule example

It is worth noting that once we pick the When ...

Get Mastering ServiceNow Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.