Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

copy sctask comments to ritm

nameisnani
Mega Sage

Hi Team ,

 

can anyone please help me on this requiement .

 

Ony for particular catalog item ' Snow Support ' 

 

whenever sctask worknotes is updated the same comments should copy in ritm additinal comments . 

 

how to configure , can any one please help me .

 

@Ankur Bawiskar  Please help me here 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@nameisnani 

you can use after update business rule on sc_task

Condition: Work notes Changes && current.request_item.cat_item.name == 'Your Item Name'

Script:

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

    // Add your code here
    var ritm = current.request_item.getRefRecord();
    ritm.work_notes = current.work_notes.getJournalEntry(1);
    ritm.update();

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

@nameisnani 

you can use after update business rule on sc_task

Condition: Work notes Changes && current.request_item.cat_item.name == 'Your Item Name'

Script:

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

    // Add your code here
    var ritm = current.request_item.getRefRecord();
    ritm.work_notes = current.work_notes.getJournalEntry(1);
    ritm.update();

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar  sure let me try 

@nameisnani 

You should not directly copy paste what we share in community.

Please enhance it  based on your developer skills and experience.

I believe you know how to apply filter conditions in business rules.

If not then I will suggest to enroll in Scripting Fundamentals course on now learning.

For the above you should use this

current.work_notes.changes() && current.request_item.cat_item.name == 'ServiceNow Support'

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader