Update Catalog Task worknotes through workflow run script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2019 09:11 AM
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.
- Labels:
-
Incident Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2019 09:34 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2019 10:24 AM
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.