- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2014 10:22 AM
I have a workflow on the sc_req_item table. I would like a task to be assigned to the person who opened the ticket. Here is my scenario
- Have several catalog tasks Task A, Task B, Task C
- Task A is completed goes to Task B
- Task B is completed--Task C is then created automatically when Task B is completed, It shows the opened by of Task C to be the person who closed Task B
- I would like to automatically assign the ticket to the person who created the ticket
- This is What I have tried
- task.assigned_to = current.opened_by;
- However that set the value to the person who made the original request (Loren Smith) and not the individual (Kirk Smith) who closed the previous step.
- task.assigned_to = current.opened_by;
When I look at the Activity for the Task it states the following:
03/04/2014 10:19 AM Kirk Smith - Changed: Assigned to, Impact, Opened by, Priority
Assigned to: Loren Smith
Impact: 3 - Low
Opened by: Kirk Smith
Priority: 4 - Low
So how do I get to read the correct Opened by: so it Assigns the ticket to Kirk Smith.
I have also tried:
task.assigned_to = sc_task.opened_by;
task.assigned_to = task.opened_by;
Both of these commands do populate the Assigned To field.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2014 10:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2014 10:42 AM
Try:
task.assigned_to = gs.getUserID();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2014 11:36 AM
That seemed to work thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2014 12:10 PM
that should work for you since the tasks are sequential... but what to do when they are NOT sequential... say you want task 3 assigned to whoever completed task 1?
Glad you asked... hehehe
creae a field on task called task_id that contains the original short description of the task <this is a good idea no matter what>
then you can modify the following script to assign the task to someone that closed any other task in the workflow based on the task_id <we use it to set the assignment group>....
assigntask();
function assigntask()
{
var taskid= "Configure workstation";
var task1 = new GlideRecord("sc_task");
task1.addQuery("parent", current.sys_id);
task1.addQuery("u_task_id","CONTAINS",taskid);
task1.query();
if (task1.next()) {
task.assignment_group = task1.assignment_group;