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

Try



if (gr.get(current.request_item))



instead of current.parent on line 4.


No Bueno.... still not working for me.



find_real_file.png


Anything to do with these fields being journal fields?


No, it will still detect the condition Work notes changes.



Did you turn on business rule debugging and see if it is meeting the condition?



System Diagnostics> Debug Business Rule (details) and then try again and observe the output at the bottom.



Debugging Tools Best Practices - ServiceNow Wiki


Didn't even know that was an option existed.. cool beans. I enabled this and it seems to be firing (if I'm reading this correctly).. just not pushing the values around.



find_real_file.png