Execution order between After Business Rule with order 1000 and a Flow not expected!

trangdan106
Tera Contributor

Hello all,

I noticed in the docs that the flow should execute before the after business rule of orther >1000: https://www.servicenow.com/docs/r/de-DE/api-reference/scripts/r_ExecutionOrderScriptsAndEngines.html

However, I have a scenario where I have a flow that create a case and a business rule that check if the case existed then it will send an email, the business rule is after at order 1000, the business rule cannot capture the related case.

I am expecting it to capture the flow created case as per the docs.

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@trangdan106 

Workaround

-> make the BR async or use an event/notification that runs after the case is created, so you are not racing the flow

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

I'm more interested in the reason behind why it doesn't work as the docs mentioned.

Race condition? Or something else? And would this happen always? From my experience, it happens all the time.

@trangdan106 

I believe it's race condition.

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

Tanushree Maiti
Giga Patron

Hi @trangdan106 

 

1. An after Business Rule runs synchronously with the initial database operation, whereas a Flow is queued to run subsequently.

  • Changing your Business Rule type to Async allows the Flow enough time to finish creating the case so the record can be properly captured
  • If you stick to use After BR, Set the Business Rule Order higher (e.g. >1200) to ensure it triggers after other standard engine action.

2. (Recommended) ServiceNow recommends utilizing Flow Designer to handle the post-creation notification process rather than mixing synchronous/asynchronous scripting logic.

  • Add a Send Email action immediately following the "Create Case" step.
Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: