
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2018 04:07 AM
I need to edit a field on a newly created catalog task, as soon as it's created. Normally, I would just do task.field = , but the field I need to update doesn't actually sit on the sc_task table, it sits on the sc_request table and I know you can't do the following:
task.request.requested_for = "foobar";
task.request.update();
I read this post: https://community.servicenow.com/community?id=community_question&sys_id=80570369db1cdbc01dcaf3231f96...
but I'm not sure.
So, I did get it to work, but there must be a better way.
Here's a diagrammed way I have it now:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2018 08:22 AM
I was actually able to capture the sys_id of the created task (created by the Catalog Task workflow activity) directly in the advanced script section using
workflow.scratchpad.taskid = task.setNewGuid();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2018 08:22 AM
I was actually able to capture the sys_id of the created task (created by the Catalog Task workflow activity) directly in the advanced script section using
workflow.scratchpad.taskid = task.setNewGuid();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2018 08:29 AM
Not sure how that works because setNewGuid() you have to manually enter a sys_id

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2018 08:32 AM
Maybe this instead? workflow.scratchpad.taskid = task.setNewGuid(gs.generateGUID());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2018 08:40 AM
This was script I found in another post on this topic. Here it is in my activity. I have the log commented out, but when I was testing, it logged the sys_id correctly for the task that was created by that activity. I then use a GlideRecord later in the workflow to update that same task using that scratchpad variable and it works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2018 10:07 AM
Well.. very interesting. Thank you for sharing!