How could I get the workflow Task assigned_to name to use to another task

Andre6
Mega Expert

Hi,

I'm trying to get the Task assigned_to name from a Task and paste the name to another Task work notes.
Ex.: From Task 1, I want to get the Task assigned_to name and then paste the name to the Task3 work notes

Andre6_0-1686921637729.png

I tried with that script in

Task1

workflow.scratchpad.task1 = task.assigned_to;

 

Task3, but it paste me the assigned_to name of the previous Task (Task 2)

var gra = new GlideRecord('sc_task');
gra.get(workflow.scratchpad.task1);
var assignee = gra.assigned_to.getDisplayValue();

 

I need your lights!

 

Thanks

1 ACCEPTED SOLUTION

I resolved my issue.
I made a change to the Task1:

workflow.scratchpad.task1 = task.setNewid();

Modified Task2 and Task4 by using workflow.scratchpad.task2
Task3:

var gra = new GlideRecord('sc_task');
gra.get(workflow.scratchpad.task1);
assignee = gra.assigned_to;

 

use assignee.getDisplayValue() in the work notes
now all Tasks work as expected
Thanks for help!

View solution in original post

6 REPLIES 6

monika94
Kilo Guru

Hi @Andre6,

 

From task 1 can you use display value directly instead of using GlideRecord to get it in task3?

Task 1

workflow.scratchpad.task1 = task.assigned_to.getDisplayValue()

 

Task 3 

Use workflow.scratchpad.task1 directly to set worknotes

 

 

Hi Monikay94,

 

Thanks, I like the fact that it uses less scripting, but it still gives the same issue.
I'm not getting the Task1 assigned_to name but it picks the Task2 assigned_to name.
Both tasks are not assigned to the same team/member.

Is task assigned_to is hard coded?

I don't know
I see that it paste the user sys_id from the Task2, but if I add the .getDisplayValue(), I see the name
But I don't know how the Task assigned_to settled
I see this if I select show "assigned_to"

 

Andre6_0-1686928841874.png