There are four types of Business Rules in ServiceNow
- Before business rules
- After business rules
- Display business rules
- Async business rules
In ServiceNow, Display Business Rules are a type of business rule that allows you to control the visibility and behavior of form elements (fields, sections, related lists, etc.) on a form in the user interface.
Display Business Rules run when a user requests a record/load a form, data has been retrieved from the database, and before the form is presented back to the user.
Display Business Rules use g_scratchpad object to store server-side script results and send them to the client-side. 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.
Client-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.
// From client script
if(g_scratchpad.someName == "someValue") {
//do something special
}
0 comments:
Post a Comment