S

2 Messages

 • 

5 Points

Friday, June 30th, 2023 6:09 PM

assign a user to a task in workflow designer

I am using workflow designer and I have a task to select a user and I want to assign that selected user to the next task. I have a script task in between tasks to get and set the variable and I have that new variable in my candidate role in the next task but I keep getting an error.

Here is my script task:

task setStewardVariable() {
// Get the previously chosen user from the variable
def steward = execution.getVariable(“selectedSteward”);

// Set the value of the 'businessSteward' variable
execution.setVariable("steward", steward);

}

I am defining the candidate user as ${businessSteward} in the next task.

Some error I am getting are the user expression is invalid and I don’t think the script task is working at all

91 Messages

 • 

905 Points

1 year ago

Hello,
there are two things that may be off:

  1. if your user expression for the next task uses the variable businessSteward then you should also set this variable in the script task
    execution.setVariable(“businessSteward”, steward);
  2. If you want to reference a specific user then the user task candidate user expression should look like this:
    user(${businessSteward})
    In my experience it uses the user name of the user (and not the UUID), but I can’t see what value you use here.

18 Messages

 • 

2.1K Points

1 year ago

Hi Silina,
In the candidate user expression you should set as user(${steward}) in your case.
Since user expression supports multiple assignment types such as assigning to role you should specify whether the candidate user is a single user/ role/ group/role for a specific resource.
Eg:
You can specify candidate users by using candidate user expressions, such as role(Business Steward) , user(John) , or group(Data Custodians)or role(‘Business Steward’, ‘YourCommunityName’)

Loading...