Execution order between After Business Rule with order 1000 and a Flow not expected!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
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! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
48m ago
I believe it's race condition.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
23m ago
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.