Business rules A business rule is a server-side script that runs when a record is displayed, inserted, updated, or deleted, or when a table is queried. Use business rules to accomplish tasks like automatically changing values in form fields when certain conditions are met, or to create events for email notifications and script actions.Note: Business rules can make use of scripts to take actions on records in the database. However, there are several other scripting options available on the platform, such as client scripts and UI actions. How business rules workTo configure business rules, you first need to determine when the business rule should run and what action it should take.Business rules in scoped applicationsEvery business rule is assigned to either a private application scope or to the global scope. Create a business ruleYou can create any type of business rule from the Business Rule form.Global variables in business rulesPredefined global variables are available for use in business rules.Compare date fields in a business ruleIt is possible to compare two date fields or two date and time fields in a business rule.Parse XML payloadsFields in XML format can be parsed with the system's getXMLText function.Abort a database action in a before business-ruleIn a before business rule script, you can cancel or abort the current database action.Determine the operation that triggered the business ruleYou can write a script for a business rule that is triggered on more than one database action.Display business-rulesDisplay rules are processed when a user requests a record form.Use an OR condition in a business ruleAn OR condition can be added to any query part within a business rule.Reference a Glide list from a business ruleA field defined as a glide list is an array of values stored in a single field.Use indexOf("searchString") to find a string in a Glide listUse indexOf("searchString") to return the location of the string passed into the method if the glide list field, such as a Watch list, has at least one value in it.Task active state management business ruleA business rule that determines if the active field needs to change based on state changes.Example script: Locking user accountsAn example script to lock user accounts if the user is not active in the LDAP directory or the user does not have self-service, itil, or admin access to the instance.Example script: default before-query business ruleYou can use a query business rule that executes before a database query is made.