How to assign a task to 3-4 users of different group?

I have a user input task , I want to assign task to 3-4 users dynamically using if else

for example:

local!flag:true

local!myArray: {
{ name: "Aish", category: "A" },
{ name: "Jenny", category: "A" },

},

if local!flag is true, assign task to users in local!myArray ,

else assign task to a single user i.e loggedinuser()

Please help

  Discussion posts and replies are publicly visible

Parents
  • There are two parts to this:

    1. How do I dynamically assign a Task to a list of Users? 

    2. How do I ensure that each User gets their own copy of the Task

    The first part is relatively straightforward. Create a process variable of type 'User' and make it a multiple so that it can hold an array of Users. In your example you would branch (using an XOR) depending on the value of local!flag. In the false branch set your new process variable to loggedInUser(). In the true branch extract the User accounts from your array, cast them to User (if needed) and store them in the same process variable.

    In your User Input Task you can set the Assignment to use the value it find in your process variable.

    The second part - to ensure each assigned User gets their own copy of the Task - requires you make the User Input Task an MNI (multi-node instance). Go to the 'Other' tab of the User Input Task, check the 'Automatically run multiple instances of this node' checkbox and then select the 'Run one instance for each assignee' radio button.

    Then comes the slightly harder part - deciding whether you want the process to flow downstream each time a User completes their Task or when they've all completed their tasks. That depends entirely on what output the User Input Tasks pass back to the process model and what you want/need to do with that

  • I'll use this dynamic code to assign the task 

    a!localVariables(
    local!flag: true,
    local!myArray: {
    { name: "username1", category: "A" },
    { name: "username2", category: "A" },

    },
    if(
    local!flag,
    touser(local!myArray.name),
    loggedInUser()
    )
    )

    So now I want if local!flag is true, it would create 2 separate task for the users in array, and if false then it would create a single task of logggedin user, so how to do this in user input task?

    if I do this , check the 'Automatically run multiple instances of this node' checkbox,  then will it work fine also if the local!flag is false?

Reply
  • I'll use this dynamic code to assign the task 

    a!localVariables(
    local!flag: true,
    local!myArray: {
    { name: "username1", category: "A" },
    { name: "username2", category: "A" },

    },
    if(
    local!flag,
    touser(local!myArray.name),
    loggedInUser()
    )
    )

    So now I want if local!flag is true, it would create 2 separate task for the users in array, and if false then it would create a single task of logggedin user, so how to do this in user input task?

    if I do this , check the 'Automatically run multiple instances of this node' checkbox,  then will it work fine also if the local!flag is false?

Children
No Data