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

Additional comments(customer visible) copy to RITM

John Vo1
Tera Guru

Currently I have a BR called Work notes to RITM.   This will copy what was put in the task under work notes and pull that up to RITM.  

Here is the script:

find_real_file.png

What do I need to add to the script so additional comments (customer visible) gets copied up to RITM as well?

1 ACCEPTED SOLUTION

Hi John,



Not sure of already got the answer, got some time to do some testing as I promised and here is the test it did:



Type: Business Rule


Table: sc_task


Parameters: Run: Before insert and update


Filter Conditions: Additional comments or work notes changes


Script:


cascadeComment();


function cascadeComment(){


var gr=new GlideRecord("sc_req_item");


gr.get(current.request_item);



gr.work_notes=current.work_notes;


gr.comments=current.comments;


gr.update();


}



And I can see comments and work_notes are updated in activity formatter. Try this and see if this helps



Screen Shot 2017-07-23 at 10.11.23 PM.png



Screen Shot 2017-07-23 at 10.11.30 PM.png



Screen Shot 2017-07-23 at 10.11.44 PM.png



Screen Shot 2017-07-23 at 10.11.56 PM.png


View solution in original post

22 REPLIES 22

I have removed all additional comments and comments and work_notes that I dot walk.


Let me do some testing from my side and I will provide you an update.



Shruti


Shruti,



I look forward to seeing if you can come up with a resolution for this.



Thanks,


John


Hi John,



Not sure of already got the answer, got some time to do some testing as I promised and here is the test it did:



Type: Business Rule


Table: sc_task


Parameters: Run: Before insert and update


Filter Conditions: Additional comments or work notes changes


Script:


cascadeComment();


function cascadeComment(){


var gr=new GlideRecord("sc_req_item");


gr.get(current.request_item);



gr.work_notes=current.work_notes;


gr.comments=current.comments;


gr.update();


}



And I can see comments and work_notes are updated in activity formatter. Try this and see if this helps



Screen Shot 2017-07-23 at 10.11.23 PM.png



Screen Shot 2017-07-23 at 10.11.30 PM.png



Screen Shot 2017-07-23 at 10.11.44 PM.png



Screen Shot 2017-07-23 at 10.11.56 PM.png


I am using a very similar code to what what you have



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


var gr = new GlideRecord('sc_req_item');


gr.get(current.request_item);


gr.comments = current.comments;


gr.work_notes = current.work_notes;


gr.update();


})(current, previous);



But it was causing a lot of slowness. I opened a Hi ticket and they suggested the following:




"In the BR code, you can put a if condition such that if you get undefined then the further check of the records wont go through."




Do you have a suggestion for what code to add to achieve that?