Using RITM variables in workflow

Joe Taylor
Giga Guru

I have an catalog item with various variables.

Two of them are pulldowns of people in specific user groups.

Let's call the first pulldown variable:  user1   (user1 is in a group called "FirstGroup")

Let's call the second pulldown variable user2.  (user2 is in a group called "SecondGroup")

I want to make "user1" my approver in the workflow.

After the approval step, I want to create an SCTASK and assign it to Group "SecondGroup" and also specifically to "user2".

What's the best way to do this in my workflow?

1 ACCEPTED SOLUTION

use below for dynamic

answer = [];
answer.push(current.variables.hrbp.toString());

For task 

Is your hrbp variables a reference field ? can you share screenshot?

aslo try

task.setDisplayValue('assignment_group', 'HRD Group');
task.assigned_to = current.variables.hrd.toString();

View solution in original post

12 REPLIES 12

SanjivMeher
Kilo Patron
Kilo Patron

In the Approval-User activity in workflow, use answer = current.variables.user1.

To set assignment in Task, Use a Create Catalog Task activity and use following script

 

var grp = new GlideRecord('sys_user_group');

grp.addQuery('user',current.variables.user2);

grp.query();

 

if (grp.next())

{

task.assignment_group = grp.group;

}


Please mark this response as correct or helpful if it assisted you with your question.

Subhanand
Tera Guru

You can use "current.variables.FirstGroup" in the approval group activity

find_real_file.png

Wwhich will trigger the approval likewise for the task

find_real_file.png

Joe Taylor
Giga Guru

Hi Sanjiv,

Neither of these scripts worked for me.

My actual user1 variable name is "hrbp".

First of all, the approval is for a single user, not a group.

So I  tried answer.push(current.variables.hrbp);

This didn't work, so I tried an experiment to explictly assign this to someone:

answer.push('b8fab8231ba60810afa40dc8cd4bcbdd');

This didn't work either.

 

For the task, my actual Group name is "HRD Group" and the user variable is "hrd".

 

task.assignment_group = 'HRD Group';
task.assigned_to = 'current.variables.hrd';

 

This didn't assign the task to the group nor the user.

If you want to add user as approver then you need to add below in script section of approval user activity.

 

answer = [];
answer.push('b8fab8231ba60810afa40dc8cd4bcbdd');

to assign task, you need to do below

task.setDisplayValue('assignment_group', 'HRD Group');
task.assigned_to = current.variables.hrd;