Copy additional comments from requested item item to all catalog tasks.

SK41
Giga Guru

Hi,

I have a requirement where  i have  to copy the additional  comments from  requested  item to all the  catalog tasks.Once the   item  is  approved all  the comments after the RITM  is approved,  should  be  copied  to  each  and  every  catalog tasks.

How  can i achieve  that?

Thanks.

26 REPLIES 26

hi,

the approval condition is not working. I added it in filter condition too and in the script condition  but it is not working.         

Hi,

The approval condition works only when you have set the approval field to approved for that ritm in the workflow.

Go to your workflow and check if approval action is set to approved in the workflow after approved activity.

Kindly mark the comments as helpful if this helps.

SK41
Giga Guru

Hi,

I  have tried below script:(before insert/update  BR on requested item)

in condition:current.approval=='Approved'

in  script:

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

var sc_task = new GlideRecord('sc_task');
sc_task.addQuery('request_item', current.sys_id);
sc_task.addActiveQuery();
sc_task.query();
while (sc_task.next()) {
sc_task.comments = current.comments.getJournalEntry(-1);

sc_task.update();

}

But  it  is copying  all the comments before  approval  also. I  guess  condition  is  not working.  Also,  using   getJournalEntry(-1);  copies every comment even if   one comment  is added,  it copies  all the  previous comments  again  and  again.

My  requirement  is  to  copy all the  comments after RITM  is approved to all the  catalog tasks  and  no  comments is  copied  again.         

Hi,

Updated condition:

in condition:current.approval == 'approved'

when this BR runs it would pick the latest comments only from RITM.

Regards
Ankur

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

should  i use journalentry(-1)  in the  script?