servicenow business rule interview questions
What are Business Rules? What are the different type of 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.
There are 4 type of business rules.
1. Display BR.
2. Before BR.
3. After BR.
4. Asynch BR.
What is the difference between after and asynch BR?
After BR : This type of BR is used when some field changes needs to be reflected immediately after user saves the record. Mostly used to update/insert record into another table once insert/update/delete operation is performed on current record.
Below is an example where After BR can be used
- On reassignment of incident, add comments in associated problem record.
Asynch BR : As name suggest, it runs asynchronously. Whenever Asynch BR is triggered, system creates new entry in event queue to process. Execution time varies for Asynch BR based on the load on event queue.
What are the different objects accessible in BR?
- Current
- Previous
- gs
- g_scratchpad
Note: Previous object is null in Asynch BR, as there could be multiple updates on same record while BR is in queue for execution which might create conflict on which version needs to be considered as previous.
What is display BR? When to use it? Explain with real time use case?
Display rules are processed when a user requests a record form. The data is read from the database, display rules are executed, and the form is presented to the user.
The primary objective of display rules is to use a shared scratchpad object, g_scratchpad, which is also sent to the client side as part of the form. This can be useful when you need to build client scripts that require server data which is not typically part of the record being displayed.
Real time use case : If logged in user is member of current assignment group then only show description field.
We can write display BR as shown below to check if logged in user is part of current group or not and store result in g_scratchpad object, which later can be accessed in client script to show/hide description field accordingly.
Display BR configuration details :
Display BR Script :
On Load Client Script :
What is query BR? What is primary objective of it? Explain it with real time use case?
Before query business rule gets executed whenever query made to the database on particular table.
The primary objective of query BR is to hide/show records, this could be based on conditions.
Real time use case : Show only active users to all users who is not having admin or user_admin role.
Below BR is OOTB, it checks if user has admin or user_admin role, if yes then it shows all user records else shows only active users.
BR configuration:
BR Script :
What is the difference between query BR and ACL?
1.Query business rules only apply for read access at the row level while ACLs can do CRUD operation at the row and column level.
2. Query BRs will affect a GlideRecord query result where ACLs will not unless we are using GlideRecordSecure class.
3. Query BR shows only those records where filter criteria matched while ACL shows all pages with the restricted records being invisible and a message at the bottom 'some records removed due to security'.
What are global Business Rules?
A global Business Rule is a Business Rule where the selected Table is Global. Any other script can call global Business Rules. Global Business Rules have no condition or table restrictions and load on every page in the system.
Note : The reason we would need to use Global Business rules in the past is if we wanted a custom globally accessible function, such as getMyGroups, or getUser. Now a days we can do the same thing in Script Includes which has less performance impacting way.
How to prevent form submission via Business Rule?
We can use 'current.setAbortAction(true)' in Business Rule script to abort action. This will stop data updation in database.
How to identify if current operation is insert, update or delete in Business Rules?
We can use current.operation() in BR. Depending on current operation, it returns update, delete or insert value.
How to trigger notification via Business Rules?
We can use gs.eventQueue method to trigger notification via business rule.
Syntax : gs.eventQueue('event_name',current,'param1','param2');
What is the result data if we filter only active records through Query BR and add reference qualifier with active =false condition?
It will show 0 records, since query BR gets executed whenever query made to the table which will return only active records and as reference qualifier is adding active =false filter, system will show 0 records.
Assignment for you:
1. Which type of BR shouldn't include current.update() and why?
2. Explain advantages of Asynch BR over After BR or vice versa.
3. Can we call scheduled job from BR?
4. Did you ever called script include in BR? Why we call script include in BR if we can write same script in BR itself?
Real Time Sample Questions:
1. How do you debug BR? What are the different ways to debug BR?
2. Explain any scenario where we can't use Asynch BR?
3. Explain any scenario where we can use Display BR instead of using GlideAjax?
Fuel My Passion
Loving the content? Well, of course you are. Here’s your chance to indirectly fuel the chaos that keeps this website running. Your contribution helps keep the wheels turning and allows me to continue pretending to be a responsible adult—while cranking out more content for you. Thanks for supporting my delusional dreams and helping me keep this website alive!
Buy Me a Coffee
Support with UPI
If you prefer making a UPI payment to support the website maintenance cost, scan the QR code below:

User Added Interview Question and Answers
Sir, I am confused about when to use before, after, async business rule? I know what they are and how they work but it seems like what can be done with before can also be done with after, so what's the point of them and next question is if in async business rule there is no current and previous then how we can access the current record while using async business rule? and where should we use trycatch
What is the backend process in service catalog?
How to call business rules from scheduled job
What is order of running the rules like which rule runs first business rules ,second Ui policy and so on
how to call script include in business rules?
how to call an event through business rule?
What is GlideRecordSecure? What is the difference between GlideRecord and GlideRecordSecure: Answer: GlideRecordSecure is a version of GlideRecord that provides an additional layer of security. GlideRecordSecure is designed to prevent unauthorized access to data. GlideRecordSecure enforces access controls and ensures that the user has permission to access the records they are querying. Developers can then use GlideRecordSecure in the same way as GlideRecord to query and manipulate ServiceNow records. GlideRecord queries and manipulates data in the same way as GlideRecordSecure, but GlideRecordSecure provides additional features for securing sensitive data. This ensures that sensitive data cannot be intercepted by unauthorized users as it enforces access controls. Another difference between the two is performance, Because GlideRecordSecure enforces access controls, it may take longer to execute queries than GlideRecord.
Interviewer asked me why we use async BR to trigger notification instead of this we can also trigger notification by it's condition itself. Why we need BR can someone please answer?
what is main difference between UI Policy and Client Scripts.
Whether the g_scarthpad can be used on all the types of client script?
Hi How to autoclose REQ and RITM when task is closed.
Hi I have asked a question when the incident state is closed related problem state should also be closed How can we do this
How to trouble shoot if user is not able to login?
What if we have before query BR which is filtering data to show only active incidents. what will happen if we use the fix script on the incident(via glideRecord) will it show all the records in the present in the incident table if no addQuery is used?
Why current.update() in before BR doesn't create recursion call to same BR infinitely?
I was given a scenario where I said, I can use after BR to achieve it. But, he asked me why After BR? why not before or Asynch BR? I was not able to justify my answer. Can somebody explain what should be the proper answer to this question? this was asked two times to me for different scenario.
🚀 Power Up Your ServiceNow Career
Join a growing community of smart ServiceNow professionals to stay ahead in interviews, sharpen your development skills, and accelerate your career.