Getting notification for every update
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2025 12:58 AM - edited 01-10-2025 01:01 AM
Hi Everyone,
I am struck with this requirement. Kindly provide solution for the below requirement.
I have a requirement when the work order task (wm_task) is unassigned for more than 30 minutes, I should get the notification.
I have created a business rule
There are 2 issues:
1. Case 1: WOT is manually created with assigned to field as empty
If the condition is satisfied, the notification is triggered. But notification should not trigger for every update. For example, an unassigned WOT got the notification one-time, as the condition is satisfied. Since the notification is received, I should not get another notification, if I make some other changes in the WOT record.
2. Case 2: WOT is auto-assigned
In this case, notification is triggered twice. The state of WOT changes from 'assigned' to 'pending dispatch'. And the 'assigned to' field made as empty. These are the 2 updates. That is why, I got 2 notifications.
If the WOT is unassigned, then it should trigger notification once. It should not trigger more than once if the condition is satisfied. It should not trigger for every update. Only if there are changes in 'assigned to' field, then it should trigger notification.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2025 11:18 AM - edited 01-10-2025 11:24 AM
Hi,
In your business rule, try adding conditions in the script. For update, the notification will be sent only if the “assigned to” field is modified and empty.
if(current.operation() == 'insert') {
gs.eventQueue('ho.fsm.wot.emptyAssignee', current, current.sys_id);
}
if(current.operation() == 'update' && current.assigned_to.changes() && current.assigned_to.nil()) {
gs.eventQueue('ho.fsm.wot.emptyAssignee', current, current.sys_id);
}
If my answer helped you in any way, please then mark it as helpful or correct. This will help others finding a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2025 12:29 PM - edited 01-10-2025 12:52 PM
Hi, @deepikag0508.,
Query - how the system is checking about "unassigned for more than 30 minutes", BR will trigger only when some change happen [ insert/or/update ] on unassiged wm_task record otherwise not.
Let's an ideal case-> new wm_task created, unassigned and no update, 30 minutes passed .... 60 minutes passed .... in this case, which process will trigger the notification. I don't think, BR is right tool to do this job, instead system needs a scheduler who keep checking every unassiged wm_task at 30minutes interval and compare the current time with wm_task created time, if it's more than 30minutes gap then trigger the event for notification.
Check the same condition applied on incident table for scheduler. In your case, you need apply same condition on wm_task table and get the list of eligible record and then iterate the list and pass each record details to event for notification.
Let me know if i am missing something here.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution