Notification Triggered Before Business Rule Updates Field in Offboarding Lifecycle Event
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2025 11:40 AM
Hi everyone,
I'm encountering a timing issue in the Offboarding lifecycle event in HRSD.
Here’s the scenario:
A notification is triggered when an Activity in the Offboarding lifecycle (specifically, the activity to confirm the Last Actual Working Date) is marked as complete.
After the activity is completed, a Business Rule runs, which copies the Last Actual Working Date into a custom field in the HR Profile of the employee (leaver).
The issue is that the notification is sent out a few seconds before the Business Rule completes its update.
As a result, the field value (Last Actual Working Date) is blank in the notification.
Has anyone faced a similar issue?
How can I make sure the field is populated before the notification is triggered?
Any suggestions are appreciated!
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 03:43 AM
Hello @GhitaB,
-
Asynchronous Operations:ServiceNow events and business rules can run concurrently, and the notification may be triggered before the business rule's update is completed.
-
Delaying the Notification:You can add a slight delay to the notification script to allow the business rule to finish updating the field.
-
Using a Workflow:You can create a workflow that executes the business rule and then triggers the notification, ensuring the field is updated before the notification is sent.
-
Event Queue:In some cases, you can use the
gs.eventQueue()
method to trigger the notification, which allows you to specify a delay before sending the notification.
-
1. Delay the Notification:Add a script in the notification that waits a few seconds before sending the email.
-
2. Use a Workflow:Design a workflow that:
- Completes the activity in the lifecycle event.
- Executes the business rule to update the field.
- Triggers the notification.
-
3. Use Event Queue:Instead of directly triggering the notification, use
gs.eventQueue()
to queue the notification and specify a delay before sending it. -
4. Adjust Business Rule Execution:Ensure your business rule is configured to update the field as quickly as possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 03:17 AM
Hi thank you for the information, just a quick questioncan we instead of activity ,create a business rule? or set a timer for the actvity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 03:31 AM
I think your best choice is to update your trigger of your notification from "after activity x" to "when event xy fired".
In your Business Rule where you copy your last working day you should add the gs.eventQueue() command at the end to fill your event. With this solution your notification should trigger after the copying part.
if you want you could consider a different solution. you could change the trigger of your notification to watch the HR Profile Table and triggers when your field is updated and not empty. Or Create a new BR with the same trigger condition and do stuff. Its up to you.
The same solutions could be made with flow as abbas suggested. (create trigger on HR Profile -> Set an Fire Event action)
Its up to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 03:36 AM
Thank you so much