Advanced Business Rules – Display

Business rules fire on database activity or interaction with the database.  A “display” business rule fires when the data for a record is read from the database.

What are Display Business Rules and what can they do?

You might wonder what a “display” rule is, since clicking the “Advanced” button on a business rule only shows four checkboxes indicating what action the rule fires on Insert, Update, Delete, or Query.  The “display” option is found in the “When” field dropdown.

When “display” is selected, the four checkboxes disappear since they are not relevant.

A frequent use for displaying business rules is to get server data that is not on the record retrieved and put that data into a shared object called g_scratchpad, which will then be available for use by a client script.  For instance, a display rule could get the caller’s phone number from their user record even though it’s not on the request itself and have it available for a client script to use.

This is useful because:

  • It prevents the client script from having to make a separate call to the server to get the extra data.
  • Also, in comparison to making a query to a Glide Record to get server data, which gets the entire record, this method only gets the data that is needed (e.g., the phone number).
  • Because of the previous two points, it’s more efficient and better for performance, especially with large amounts of records or users.

Using a business rule and client script together like this is not necessarily complicated.  Let’s look at a simple example demonstrating the use of g_scratchpad.


On this custom form the field labeled “Resource User” is a Reference field that points to the sys_user table.

Lets’ say that management wants to display the Resource User’s email address on the form without storing it in a field.   The form should always show the current address pulled from the Resource User’s user record.  A client script working with a display business rule can do that.

Build the Business Rule

  1. Open the business rule list from the form you want it to run on.
  • Click “New”
  • Fill out the needed fields:
  • Name
  • Check the Advanced checkbox
  • Select the “When to run” tab if not already selected
  • Set the “When” field to “display”.
  • Click “Save to save this business rule and keep it open.
  • Click on the Advanced tab of the business rule.
  • On this example form, Resource User (u_user) is a reference field on the sys_user table, where “email” is the email address field.  We’ll dot walk and put the email value into the scratchpad using this line of code:

         = current.getDisplayValue(‘’);

               This is what the client script could not do without going back to the server.

The “email” after the dot in can be whatever name you find useful.  Use this g_scratchpad name in the client script to get the scratchpad value for email.

  • The Advanced tab will look like this:
  • Save the business rule!

Build the Client Script

  1. Back on the form on which you want to show the email address, open the client script list.
  • Click “New”.
  • Fill out the needed fields:
    • Name
    • UI Type as appropriate
    • Type – in this example, “onload”
    • Script – as mentioned in the next step
  • The Script field is where the code is placed that gets the value(s) that the business rule put in the scratchpad.  Here is an example code that can be placed in the function (before the closing curly bracket):


This example will display a message under the field u_user, which is the Resource User field.  The message, in this case, is just the scratchpad data, which we reference using whatever name we set in the business rule:  g_scratchpad .email

  • The client script will look like this:
  • Save the client script.

Test the Result

Go back to the form on which the email address should display and open a record; or reload the page if a record is already being viewed.  The Resource Users’ email address should appear onscreen right under the Resource User field.


  • Display business rules can be used for other purposes, though putting data in g_scratchpad is a primary use.
  • By the way, multiple values can be set in g_scratchpad, not just one value as the example had.  For instance: = current.getDisplayValue(‘’);

g_scratchpad.phone1 = current.getDisplayValue(‘’);

… etc.

Remember the usefulness of using the Display Business Rule with g_scratchpad and a Client Script:  one trip to the server!