event is triggering twice and getting duplicate emails for single update?

Shantharao
Kilo Sage

Hello All,

 

I have created one event called "asset.requisition.process.approved" and calling in business rules as below 

(function executeRule(current, previous /*null when async*/) {

var usr = current.variables.on_behalf_of_user_name;
var usrMangaer = current.variables.on_behalf_of_user_name.manager;
//gs.addInfoMessage("onBehalfOfUser ;" +usr+ "user's manager :" + usrMangaer);
if(current.variables.rollback_required=="yes"){
gs.eventQueue("asset.requisition.process.approved", current, usr,usrMangaer);
}
})(current, previous);

 

Based on the below conditions my business rule is running but triggering twice for single update any possibility to resolve the issue

 

find_real_file.png

 

Getting two emails at same time how can I trouble shoot this issue, what are the possibilities for getting duplicate emails or triggering same event in twice

  

Thanks

11 REPLIES 11

Prateek kumar
Mega Sage

It should be an After update BR


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Jon G1
Kilo Sage

For anyone who reads this in the future:

There is a global business rule called "global events" that contains this line:

if (current.operation() != "insert" && current.comments.changes())
		gs.eventQueue(name + ".commented", current, gs.getUserID(), gs.getUserName());

I imagine the problem discussed in this post is the same as the one I was having. I created a BR to fire an event when a particular task type was commented, not realizing that this global business rule already does that for you.