Business Rules FAQ Table of Contents Why are variables on sc_task not returning expected results in business rule? Why am I seeing incident states and journal entries multiple times on record?Why is my business rule not triggering?Why is my inactive business rule still running?Why is my business rule not entering the if/for/while loop?Why is my business rule not working for a specific record? Frequently Asked Questions The goal of this article is to answer generic frequent requests/questions ServiceNow Technical Support receives in relation to clones. I if you have follow-up questions, please contact Technical Support. This KB will also be helpful: Business Rule Best Practices Why are variables on sc_task not returning expected results in business rule? This can happen due to the scope of the variables. If the variable has global selected, the variable is available for all catalog tasks within service catalog workflows or execution plans by default. If deselected, the variable must be associated with individual catalog tasks. Here is some documents to help: https://docs.servicenow.com/bundle/quebec-application-development/page/script/business-rules/concept/c_UsingPredefinedGlobalVariables.htmlhttps://docs.servicenow.com/bundle/quebec-servicenow-platform/page/product/service-catalog-management/task/t_CreateAVariableForACatalogItem.html Also to note making the variable global is only specific to that catalog item, it should not affect any other variable with the same name on another catalog item. Why am I seeing incident states and journal entries multiple times on record? Normally this issue is occurring due to some looping in your logic. If you are able to reproduce the issue I would always advise turning on Business rule debugging and see if any business rule on the incident is running twice. In most cases a business rule should only run once on a record, so seeing a business rule twice on a record is a clear sign that duplicate information can be found on a record. I would check that business rule and also any other business rules if they have any current.update() in the code. If so this is your biggest culprit. This normally happens as a business rule runs do to a change on a record maybe an update, you then run actions because of that business rule to change that record, then run current.update() which would run another update on that record which then would trigger the Business rule to run again which causes duplicates. If you are looking to update a record in the business rule that triggered from that same record, use a before update BR. This will allow you to catch the update and then adjust the update statement before it's pushed to the database. This would mean no need for a second update that will cause the duplication. Why is my business rule not triggering? The first thing to check if a business rule is not triggering is to turn on debug business rules and reproduce the issue. Look to see if the business rule is actually being found and check if potentially it's not meeting the set condition. If you see the business rule but failing the set condition, you will need to walk through the condition and try and find which part is not correct. Some conditions can have multiple things to check, so if you can manually validate all of them to see an issue first, then if no luck you can try and remove all the conditions and add them back one at a time to try and narrow down which condition is the issue. Another method is to remove the checks from the condition and add them into the script in the business rules and use gs.info statements to display the values so you can see live what data is found by this business rule, sometimes you may find the data you are getting is not what you thought it was. This will then help you adjust and fix up the conditions. If by chance you don't see your business rule triggering at all, this could be a few reasons but the most common is a setWorkflow(false) in your code which will stop business logic from running which is business rules. This is used in code to stop certain things from triggering in the system when doing specific work, but it can also have the after effect of business rules not triggering. If you have this then would look for any business rules that have setWorkflow(false) and see if they may be triggering before this Business rule and causing this issue. You can then review to see if you need to adjust the code so that your business rule will run. Why is my inactive business rule still running? So when a business rule is set to inactive it will not trigger from an INSERT/UPDATE/SELECT/DELETE on the given table, the system detects its inactive and will not run it. But then you still see the business rule logging in the instance. this is done through scheduled jobs. Scheduled jobs can trigger business rules, this is used at times when you have some logic and you don't want it running on every action of a record, but say you want it to run as a scheduled job every hour or maybe every day. A perfect example of this is the OOTB business rule: incident Autoclose it has logic to look through all incidents that are resolved for X amount of days and closes off the incident. Now, this doesn't need to run all the time, but its set to run hourly via the scheduled job: Autoclose incidents. Now yes you can write the script inside the scheduled job instead, but if you want to use the functionality of the business rule you can keep it inactive and call from a scheduled job. Why is my business rule not entering the if/for/while loop? Inside business rules, you may have a number of loops, where it may be an if/for/while loop and you cannot determine why it is not entering the loop. The easiest way to determine this is adding some basic debug statements. If you are checking a specific object for data or if you have another GlideRecord object in your query then you can add a simple log or info statement before the check and validate the variables inside the script so you can see during the live processing what the values are. This can help determine why they are not entering the loop and helps pinpoint where the problem could be inside the business rule. Sometimes it is hard to replicate the issue, so you can also take the code and run it in scripts - background. You will just need to create a glideRecord object for the given table from the BR and then adjust the current object to that object so you can run in scripts - background to track down where the issue is in the code. Why is my business rule not working for a specific record? This can be caused by similar issues as described above. Normally the issue relates to data on the record that doesn't meet the criteria. A common issue that is see is a field on the list view is showing (Empty) but the field actually has data in it, it could be caused by invalid characters in the field, it could be a reference field where it has data but no display value so looks to be blank. If you have issues like this it's good to show XML on the record, sometimes you can be surprised at data being in a field but not displaying in a list view. Once you find that issue you can then work to rectify the record or adjust the conditions to work for you.