Work Notes Updating 3 times in a Row under RITM

John Vo1
Tera Guru

Can someone help me out and see when someone updates the work notes and changes the state it updates the RITM 3 times in a row.

find_real_file.png

I open a ticket with SN and they told me it was a business rule I created called Work Notes to RITM.   Can someone take a look at this business rule and see what's causing the work notes to update more than once on a RITM

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Here is a snapshot of our business rule, running on sc_task to push worknotes to the RITM:



find_real_file.png



find_real_file.png



We have nothing set on the "Actions" tab. Hope that helps. I just tested this rule and it's working in our instance.


View solution in original post

17 REPLIES 17

kristenankeny
Tera Guru

I would change it from an after to a before and remove the ritm.update() line.


When I do that the RITM work notes are not getting updated.


Ah, apologies - I misread what you were attempting to do. We are pushing comments to our ritms from the tasks, this is the script I put into place:



Condition to run: additional comments changes


When to run: before update


Script: (We copy up to the ritm and then down to the task, so I preface the comment with the source so I know which to copy, so I don't end up with an infinite loop):


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



  str = current.comments;


  var pos = str.search('Update from Requested Item');



  if(pos == -1){


  gs.info('The push from Task to RITM will trigger now: ' + current.comments);


  var gr = new GlideRecord('sc_req_item');


  gr.get(current.request_item);


  gr.comments = 'Update from Task "' + current.short_description + '": ' + current.comments;


  gr.update();


  }


  else{


  gs.info('I will not push this comment from Task to RITM: ' + current.comments);


  }



})(current, previous);


So am I suppose to replace my current script with the one you provided?   If task work notes gets updated with it copy it to RITM?



Thanks,


John