Types of business rules with example.

Newbee4
Kilo Contributor

I have just started learning servicenow. Need help with few questions. Can anyone explain business rules with example.

1 ACCEPTED SOLUTION

Shubham Tipnis
Kilo Sage
Kilo Sage

Hi,

Since you are new to servicenow, I would suggest you to go through the trainings at developer.servicenow.com along with servicenow documentations to get a clearer picture of all the concepts.


As for the business rules,

Display Business Rule in ServiceNow:
Code written in display business rule get executed before the form is presented to the user and just after the data is read from the database.

For e.g. you have written the code that when xyz user click on information box then only data related to that user specific country will get displayed to user. It means that user from US can see US specific data and user from India can see India specific data.


Before Business Rule in ServiceNow:
Code written in before business rule get executed when user submits the form and data is not saved in database.
Let’s say User click on submit button --> Before business rule code executes --> information will save in database.

For e.g. Let’s say you have written the code that when user click on submit button then some extra information which in not filled by user such as user current location, user manager name and user past activities will get save when user click on submit button.

After Business Rule in ServiceNow:
Code written in after business rule get executed when user submits the form and data saved in database.
Let’s say User click on submit button --> data saved in database --> Now after business rule code get executed.

For e.g. there is parent incident and child incident and you want that related child incident will get closed automatically after the parent incident get closed by user.


Async Business Rule in ServiceNow:
Async business rules are like after business rule but it runs in the background simultaneously with other processes. Means async business rule run after the data is saved into the database.
Running on background means that use can proceed with other functionality and code will run on the background which will not impact the user while doing other transitions.

For e.g. Incident ticket is in pending customer action status and will be auto closed after 5 days if user did not provide any update on incident ticket.

 

TypeUse case
displayUse to provide client-side scripts access to server-side data.
beforeUse to update information on the current object. For example, a business rule containing current.state=3; would set the State field on the current record to the state with a value of 3.
afterUse to update information on related objects that need to be displayed immediately, such as GlideRecord queries.
asyncUse to update information on related objects that do not need to be displayed immediately, such as calculating metrics and SLAs.

 


Please mark correct/helpful if applicable.

Regards,
Shubham

Regards,
Shubham Tipnis
 ServiceNow Enthusiast
️ 3x Rising Star (2022–2024) – ServiceNow Community
 Sharing insights, use cases & real-world learnings from the Now Platform
 Always learning. Always building.

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

good explanation here

Business Rules in ServiceNow | Tutorial ServiceNow Business Rule

BUSINESS RULES TUTORIAL

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sohail Khilji
Kilo Patron
Kilo Patron

Refer this :

https://www.integrify.com/blog/posts/business-rules-explained/

https://www.basicoservicenowlearning.in/2019/12/business-rules-in-servicenow.html

 

 

Mark Correct/helpful, if applicable, Thanks!!

MF Sohail Khilji.

LinkedIn - https://www.linkedin.com/in/mf-sohail-khilji/

 

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Raghu Ram Y
Kilo Sage

Hi, 

There are four types of business rules

1. Before

2. After

2. Async

4.  Display

Before : This type of business rule will get executed when user submits the form and data is not saved in database.

After :  This type of business rule will get executed after the user submits the form and after any action is taken on the record in the database.

Async : Runs after the record is saved in background. Like after, but returns immediately and no access to previous.

Display : Run when a record is requested from the server, before the form is loaded.

For more info check here

Mark my answer as helpful and correct, if it helps

WillardLe
Tera Contributor

I think it's very important to know these rules.