Assign a Task To a Manager

In this example, we demonstrate how to configure a workflow where a task is delegated to the manager of the person who initiated the task. The process is completed when the assigned task is approved by the manager.

Step-by-Step Guide

Creating a Task to Assign to the Manager

Create a New Process

  • Select "All Folders" from the menu and click "+New Folder" to create a new folder.

  • Name the folder and select the folder type. After creating the folder, enter the folder and create a new process by typing a process name and pressing the "+" button to open the process designer.

  • In the process version screen, press the “Edit” button to open the process designer.

Create the Tasks

  • In the process designer, create two consecutive tasks. The first task will be initiated by any user in the organisation, and the second task will be for the manager's approval.

  • Hover over the right section of the action button to reveal a red dot. Clicking this red dot will allow you to create a new task from the action button.

  • When you select “Add New Task”, the system will create a new task that is directly routed from the action button.

  • Now, name the second task Manager Approval. Then, add two action buttons: Approve and Reject.

  • When the manager approves the form, the process is completed. If the manager rejects it, the task returns to the expense form. This behaviour can be adjusted using the arrows that appear from the red dot. The red dots become visible when you hover over the buttons.

  • To set the Reject button to return to the Expense Form, drag the red dot from the Reject button and drop it on the left side of the first task (Expense Form). This ensures that when the Manager rejects the approval task, the process returns to the beginning.

Assign Roles to the Tasks

This section assigns a role to the tasks you want to submit.

  • Under the scheme, a new role adds by pressing the + under the title of the role.

  • Adds a new role for each person. 

  • Gives a name and caption for roles.

  • After the named name, the caption automatically fills with the same. If necessary, it can be changed.

  • Then, the system moves to a page showing the role type and decision table. 

  • For the manager role, select "expression" from the role type dropdown.

  • The decision table will then disappear, and the expression language and coding section will appear. Choose JavaScript as the expression language.

  • In the expression section, add the code to automatically find the manager. Then, enter the provided example code.

$Membership.FindManager( $Xml.Evaluate('PersonnelInformation/Personnel') );
  • The FindManager function allows you to locate the manager of the provided identity. In this example, the identity is retrieved directly from the form using $Xml.Evaluate('PersonnelInformation/Personnel'), which gives us the identity of the person selected on the form. However, if you prefer to use the form's initiator as the identity, simply pass $Initiator as the parameter instead.

  • The selected personnel here assigns to the manager for approval.

  • After defining the role and setting up the expression, assign this role to the Manager Approval task in the process designer to ensure the task is routed to the correct manager.

  • Select the created role, Manager, from the dropdown menu titled Role.

  • Then, the second task, called Manager Approval, belongs to the manager of that personnel.

Testing

  • To close the process designer, select "Close" from the top menu.

  • Optionally, you may click “Commit Changes” to save your work.

  • Click on the “Close” button to go back to the process folder, and “Expense Form” will be displayed in the folder options.

Related articles

 

Copyright © 2010 - 2023 Emakin. All rights reserved.