Update Catalog Task worknotes through workflow run script

Anubhav24
Mega Sage
Mega Sage

Hi All,

I have a catalog task and once this task gets closed , based on value of one variable I am triggering one if condition and once this if condition is yes then I am creating a new RITM through cart API in a Run script activity, so my requirement is to update the work notes of the catalog task with this new RITM number.

Thanks.

2 REPLIES 2

Anubhav24
Mega Sage
Mega Sage

My Script which I am using in my run script activity:

var tgr = new GlideRecord('sc_task');
gs.log('Vegeta0 current.sys_id'+current.sys_id);
tgr.addQuery('request_item',current.sys_id);
tgr.query();
gs.log('Vegeta current.number'+current.number);
while(tgr.next())
{
gs.log('Vegeta1');
tgr.work_notes=rc.number;
gs.log('Vegeta2');
tgr.update();
}

all the log statements printed but it is not updating the task worknotes , also note that there are multiple tasks in this workflow.

 

Hi,

Try this code.

var tgr = new GlideRecord('sc_task');
gs.log('Vegeta0 current.sys_id'+current.sys_id);
tgr.addQuery('request_item',current.sys_id);
tgr.query();
gs.log('Vegeta current.number'+current.number);
while(tgr.next())
{
gs.log('Vegeta1');
tgr.work_notes=current.number;
gs.log('Vegeta2');
tgr.update();
}

Changed rc.number to current.number.

Mark the comment as a correct answer and also helpful once worked.