Getting notification for every update

deepikag0508
Tera Contributor

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

deepikag0508_2-1736497281593.png

 

deepikag0508_3-1736497303861.pngdeepikag0508_4-1736497350779.png

deepikag0508_0-1736499678274.png

 

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!

 

2 REPLIES 2

mandy_coelho
Tera Contributor

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.

AshishKM
Kilo Patron
Kilo Patron

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. 

 

AshishKM_0-1736542134679.png

 

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