- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2019 07:15 AM
Hello,
I have a workflow that opens a first task for approval then a series of tasks. I require the second catalog task to be assigned to the assignee of the first. I`ve tried a few things but the task keeps opening for the proper group but the assigned to is empty.
Workflow:
Script in the catalog task that is trying to assign to the tech:
Please help, we will be using this same workflow many times over.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2019 12:12 PM
I finally realized that the approval task is the one opening the next task so I added this to the approval task to pull the scratchpad and push it into the next task:
var grTask = new GlideRecord("sc_task");
grTask.addQuery("sys_id", workflow.scratchpad.TaskId);
grTask.query();
while (grTask.next()) {
grTask.assigned_to = tsk.assigned_to.sys_id;
grTask.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2019 07:23 AM
Hello Mario,
Since assignment_group is a reference field, you should either do addQuery("assignment_group.name", "EXP - Techniciens"); or add in the sys_id of the assingment group.
However a better solution would be to add in the first task (the Stella Access Approval) a line to add it to the workflow scratchpad:
workflow.scratchpad.stellaTaskId = task.setNewGuid(); // get the sys_id of this task on the workflow scratchpad
Then you could do in this task:
var grTask = new GlideRecord("sc_task");
if(grTask.get(workflow.scratchpad.stellaTaskId)){
task.assigned_to = grTask.assigned_to;
}
This would work even if the user changes the short description or assignment group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2019 07:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2019 12:12 PM
I finally realized that the approval task is the one opening the next task so I added this to the approval task to pull the scratchpad and push it into the next task:
var grTask = new GlideRecord("sc_task");
grTask.addQuery("sys_id", workflow.scratchpad.TaskId);
grTask.query();
while (grTask.next()) {
grTask.assigned_to = tsk.assigned_to.sys_id;
grTask.update();
}