copy catalog task activities to ritm

jameshamptontp
Kilo Contributor

Is there a script available that copies the worknotes entered on a catalog task back to the parent RITM record?   We are using the RITM record to provide status back to the users via the portal.

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi James,



Nothing out of the box, but you could create a business rule that does this easily enough.



Name: Copy task work notes to RITM


Table: Task (sc_task)


Insert: checked


Update: checked


When: After


Advanced: checked


Condition: Work notes Changes (or in the condition field: current.work_notes.changes())


Script:


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



  var gr = new GlideRecord('sc_req_item');


  if (gr.get(current.parent)) {


      gr.work_notes = current.work_notes;


      gr.update();


  }


})(current, previous);



You said work notes. Change to 'comments' where appropriate if that's what you meant.


View solution in original post

24 REPLIES 24

The weird part is that with the rules off the RITM does mark itself in a Closed Complete state when the task is closed but with them on.. that behavior is somehow disrupted.



I guess I just assumed that was OOTB behavior to close the RITM when all the tasks were closed. So we'd need to write an extra business rule to do this.. very odd.


It may be OOB. I just cannot find it on my instance. That doesn't mean I've mucked it up pretty good and it's time for a reset.


We've put in a HI Incident to see what the issue is. They believe it's an ordering issue of scripts being fired but when we know I'll share it here for everyone's benefit.


After much ado and gnashing of teeth it was a simple fix that had both us and the HI folks stumped for a while... lol.



Changed the order of the new business rules high enough so that they happened last. In our case, 1200.


Thanks Chuck ...this post is really old but Gold.

helped me too 🙂