The CreatorCon Call for Content is officially open! Get started here.

SncTriggerSynchronizer.executeNow(rec)

snowuser111
Kilo Guru

HI Experts,

Need help , I have a business rule for certifications.

1) First thing is its working  

2) It is executing twice

Details:

When Business rule is fired, it is checking the 'certification filter' and creates tasks , but twice . WHY? this is the issue . It should be generating only once not twice.

Any idea how to make it run only once i mean my code is:. THANKS

-----------------------------------------------------------------------------------------------------

function pdCertTest()

{

  var rec = new GlideRecord('cert_schedule');

  rec.get('name', 'Priority Incident Closure Certification');

  if (typeof SncTriggerSynchronizer != 'undefined')

  {

  //gs.addInfoMessage("Execute..");

  SncTriggerSynchronizer.executeNow(rec);

  }

}

----------------------------------------------------------------------------------------------------

1 ACCEPTED SOLUTION

There is no need of current.update() in before BR because after executing Before BRs system itself perform current.update() operation. On other hand the statement current.update() will lead to a loop of update of same record again and again. Check section 4 from below link and get more info on this.


http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices


Just remove current.update() from before BR and everything it work will fine.


View solution in original post

10 REPLIES 10

Gurpreet07
Mega Sage

How are you calling this function.Check for current.update() in other business rules.


Tanaji Patil
Tera Guru

I guess your business rule is running twice. To make sure add a log message and check. Check if any of your before business contains update().


yes there is before BR where update is there but if I remove the purpose of that rule will be lost


There is no need of current.update() in before BR because after executing Before BRs system itself perform current.update() operation. On other hand the statement current.update() will lead to a loop of update of same record again and again. Check section 4 from below link and get more info on this.


http://wiki.servicenow.com/index.php?title=Business_Rules_Best_Practices


Just remove current.update() from before BR and everything it work will fine.