How to assign tasks to users according to their roles as a step in a workflow

compared with
Current by David Glen
on Oct 18, 2007 17:38.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (19)

View page history
h3. Scenario
When designing a workflow or a process that involves a user step, that is assigning a task to a user, it is often required for the process designer to know in advance who should the task be assigned to, whether it is Tom, or Jack, or a group. In most of the cases, the user might varied per process instance. Designing a process user step that assigns task to a user or group, loses the flexibility to achieve that. For each process instance, it will run with the exactly same pattern depending on how the process is designed, in this case the same user/group get assigned the task again and again.
When designing a workflow or a process that involves a user step, that is assigning a task to a user, it is often a requirement for the process designer to know in advance who the task should be assigned to, be it Tom, or Jack, or a group. In most cases, the user might vary per process instance. Designing a process user step, which assigns the task to a user or group, looses the flexibility to achieve that. For each process instance it will run with the exact same pattern depending on how the process is designed, and in this case the same user/group gets assigned the task again and again.
 
To make it dynamically assign task to a user/group, we could use process variable that store the user/group identifier and then assigning a task to a user/group based on the process variable value.
To make it dynamically assign a task to a user/group, we could use the process variable that stores the user/group identifier and then assign the task to a user/group based on the process variable value.
 
In a process that has multiple user steps of different levels, it is necessary to know who can be assigned to what tasks. And this This requires a concept of assigning task to users according to their roles. For example, a Leave Application would include the applicant, with their manager and maybe their director being involved in the process of approving or declining the leave request. Depending upon who is the applicant, their manager and/or their director might not be same person.
 
To achieve that objective, we have provided the Avoka Lookup Role User DSC including a Flex Application, to allow a process designer the ability to assign tasks to users according to their role as determined on a per process instance basis.
 
At the start of the process, it launches the Flex Application assigned to a person who has the authority to determine role for this process, and then it progresses to the steps in the process. When it comes to assigning task to a user, you need to insert a step before User step, that is calling Lookup Role User operation to find out which user holds a particular role in the current process instance, so that the User step can later use the user identifier returned for assigning task the user that holds the role.
At the start of the process, it launches the Flex Application which assigns it to a person who has the authority to determine the role for this process, and to progress it through the steps in the process. When it comes to assigning a task to a user, you need to insert a step before User step, that is calling Lookup Role User operation to find out which user holds a particular role in the current process instance, so that the User step can later use the user identifier returned, for assigning the task to the user that holds the role.
 
For maintenance on what process to have what roles, Lookup Role User provides a custom editor for a process designer to add and delete role for a process, which will be discussed in more details below.

h3. The Lookup Role User Service
This has been developed by Avoka Technologies, to work in conjunction with Lookup Role User DSC, as an application to assign roles to users. The Flex application looks like this:
!flex.jpg!
Based on the process ID that is injected into the Flex Application, it will pre-populate the form with all the roles for the process. The user can then make use of the search mechanism to find the matching user, and assign them a role or roles, by dragging and dropping the user to the role. 
 
!process.jpg!\\
\\
As shown in the figure above, at the start of the process, it initializes the Flex Application by injecting the current process ID required for the Flex Application to operate.  The second step is the Flex Application itself assigned to an authorized user to determine who holds the different roles for this current process instance. And then at the instance. The step before the user step, it has "Lookup step, has the "Lookup Role User" step to find out who holds a particular role, and in with the user step, assigning a task to the user returned from the "Lookup Role User" step.  Therefore, this achieves the assigning of tasks to users according to their roles as set on a per process instance basis. An UserRoleNotSetException will be thrown when invoking step "Lookup Role User" operation to lookup for a role, where no user has been assigned to that role. It is very likely that you will want to catch this exception and to have a route back to the Flex Application step to set role users again.
 
 
For demonstration purpose, we have provided the exported [sample process|^sampleProcess.xml]and the [Flex Application|^RoleUserSetup.swf]to set up user roles for the process described above, as attachments to this article. You can import it as a process to your LiveCycle ES via workbench for guidance in setting up property values for the Lookup Role User operation step. You will also need to upload the Flex Application to your LiveCycle ES Server via Workbench in Form Design perspective, and update the process form variable template url location accordingly.

h3. Setting up Flex Application as One of the Step in the Process
When you After you have downloaded the Flex Application from the link in the previous section, this is how to make it as part it part of your process.

\- Upload the Flex Application form to LiveCycle ES Server via Workbench on its "Form Design" perspective. Go to "Resources" view and you can drag and drop the Flex Application (.swf) file into that view to your desired folder.
\- Switch to "Process Design" perspective on your Workbench and make sure you are currently editing your process by right clicking on the process and select "Edit".
\- Open up "Variable" view, if it hasn't already been opened. Create a process variable of type "Form", by clicking on the "Plus" button located on top of that view. For reference, you can import the sample process attached, and import into your server via Workbench to see how the form variable is setup (Note: flexApp is the Flex Application variable).

!flexsetup.jpg|align=left!\\
!flexsettings.jpg!
 
\- Now the Flex Application has been set up as a process variable ready to be assigned to a user, alongside other properties like "Initial User Selection" that in this case, determines who gets to assign a user to each role, what is the task instruction, and so on.
 
 
!flexuser.jpg!
 
h3. Setting Properties for Setting Initial Data to Flex Application using SetValue
\\ !initialProperties.jpg!\\
\\
 
To configure the properties of the Lookup Role User operation step, click on that step, and then click on "Properties" view on your Workbench. It will show a dialog box as shown above.
Select your current process in the process combo box. It will load a list of roles for the process. Select which role you want to lookup for the role user for. For the output, it returns the principal ID and common name for the role user, if found. 

Alternatively, if you already know the role name that you want to lookup for, as stored in a process variable or form, you can specify the Role input property via "XPath" or "Variable". 

To configure the properties of the AssignTask operation step, click on that step, and then click on "Properties" view on your Workbench. It will show a dialog box as shown above.
Expand the section "Initial User Selection" and select the radio button "XPath expression" option for specifying the user to be assigned the task, and then select the user identifier returned from the "Lookup Role User" step; in this example it is stored in variable "assigned_user". You can also optionally include the user common name that gets returned by the "Lookup Role User" into the task instruction as shown above.
\\