Abusiness rulein ServiceNow is a server-side script written inJavaScriptthat executes when a record is inserted, updated, deleted, or queried. Business rules allow for automation and enforcement of business logic without requiring manual intervention.
Business rules arenot tied to formsbut instead runon the server-sidewhen a database operation occurs. They can be configured to execute:
Beforea record is saved (Before Business Rule)
Aftera record is saved (After Business Rule)
Asynchronously(Async Business Rule)
Before a query is run on the database(Query Business Rule)
Explanation of the Correct Answer:B. A business rule can be a piece of JavaScript(Correct)
Business rules are written inJavaScript, allowing administrators to define custom logic that executes on the server.
These scripts can modify data, enforce rules, validate fields, or trigger other workflows.
Example JavaScript snippet for a business rule:
if(current.state=='3'&& current.priority!='1') {
current.priority='1';
gs.addInfoMessage("Priority set to High because state is Resolved.");
}
This rule ensures that if an incident's state is changed toResolved, its priority is automatically set to High.
Why the Other Options Are Incorrect:A. A business rule must run before a database action occurs (Incorrect)
Business rulescan run before a database action occurs, but they can also executeafterorasynchronously.
Business rules have four execution types:
Before– Runs before the record is inserted/updated in the database.
After– Runs after the record is committed to the database.
Async– Runs in the background after the transaction completes.
Query– Runs before data is returned to a user (modifies query results).
C. A business rule must not run before a database action occurs (Incorrect)
This is false because some business rulesdo run beforea database action (e.g., aBefore Business Rulecan validate data before saving).
D. A business rule monitors fields on a form (Incorrect)
Business rulesdo not monitor form fields directly. Instead, they execute based on database operations.
If real-time monitoring of form fields is needed,Client Scripts(not Business Rules) are used for this purpose.
Automaticallyassigning prioritybased on ticket severity.
Preventing updates to certain records if a condition is not met.
Sending email notifications when a record changes.
Modifying data before it is saved to enforce business policies.
Example Use Cases for Business Rules:
[References:ServiceNow Documentation: Business Rules Overview, ServiceNow CSA Learning Path: Business Rule Fundamentals, ServiceNow Docs: Server-Side Scripting in Business Rules, , , ]