- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 08:37 AM
Hi,
I have a workflow that currently sends an approval to a group after a task gets completed. How do I get that approval task to be assigned to only the tech assigned to that 1st task instead of the group? I've looked at whats available in the select fields list under 'users' but wasn't able to find what I wanted because the 'assigned to' is pulling from the RITM and not the previous task in the workflow.
I feel I'll have to use the advanced script option.
Workflow shown here:
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 08:44 AM
ok the first thing you want to do is grab the sys id for the task you are going to want to grab the approver from.. so in the 1'st task put the following in the advanced script box..
workflow.scratchpad.approvalID = task.sys_id;
now in the approval we need to grab that task by the sid.. and get the approval id.
so in the approval script you will use
tsk = new GlideRecord('sc_task');
tsk.get(workflow.scratchpad.approvalID);
now in your actual function to push ids... just push the tsk.assigned_to.sys_id.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 08:44 AM
You will have to use scratchpad to pass assigned to between two workflow activities and then use advanced script to assign task to use from stored scratchpad variable value.
Check below for workflow scratchpad
https://docs.servicenow.com/bundle/helsinki-servicenow-platform/page/administer/using-workflows/concept/c_WorkflowScratchpadVariables.html
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 08:44 AM
ok the first thing you want to do is grab the sys id for the task you are going to want to grab the approver from.. so in the 1'st task put the following in the advanced script box..
workflow.scratchpad.approvalID = task.sys_id;
now in the approval we need to grab that task by the sid.. and get the approval id.
so in the approval script you will use
tsk = new GlideRecord('sc_task');
tsk.get(workflow.scratchpad.approvalID);
now in your actual function to push ids... just push the tsk.assigned_to.sys_id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 09:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2019 08:49 AM