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

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.


Thanks Chuck.   This worked perfectly.


That's good. It was untested.


I tried doing this exact same thing in our instance but it didn't work for me for some reason.



find_real_file.png



find_real_file.png



Any suggestions?