Assign tasks to the same user in subsequent generated tasks

Michael94
Tera Contributor

I've developed a Flow to generate a series of sub-tasks for HR cases. Each task's assignment group is automatically populated by various HR templates. For example, the first task (Task 1) is created by the Flow with its assignment group set to A by the HR template. Once Task 1 is completed, the Flow generates Task 2 with assignment group B. Subsequently, Task 3 is created and assigned to group A again, followed by Task 4 assigned to group B.

 

Tasks 1 and 2 are manually assigned to individuals in groups A and B respectively. Is there a way to automatically assign Tasks 3 and 4 based on the individuals assigned to Tasks 1 and 2? For instance, if person X from group A was manually assigned to Task 1, I want Task 3 to automatically assign person X.

2 REPLIES 2

Masoom_Patthan
Tera Contributor

Hi @Michael94 

To automate the assignment of Tasks 3 and 4 based on the individuals assigned to Tasks 1 and 2, you can utilize a combination of Flow Designer and Business Rules in ServiceNow. Here's a general approach you can follow:

  1. Capture Assigned Users in Task 1 and Task 2: When Tasks 1 and 2 are manually assigned to individuals in groups A and B respectively, you need to capture this information and store it somewhere in the record.

  2. Create Business Rules to Automate Assignment: Create Business Rules in ServiceNow to automatically assign Tasks 3 and 4 based on the individuals assigned to Tasks 1 and 2.

  3. Logic for Task Assignment: Implement logic within the Business Rules to determine the assignment group for Tasks 3 and 4 based on the individuals assigned to Tasks 1 and 2.

Here's an outline of how you can implement these steps:

Step 1: Capture Assigned Users

When Task 1 and Task 2 are manually assigned, update a custom field on the HR case record to store the assigned users' information. You can use script actions in Flow Designer to achieve this.

Step 2: Create Business Rules

Create Business Rules in ServiceNow to trigger when a Task 1 or Task 2 record is updated. These rules will handle the automation of Task 3 and Task 4 assignments based on the assigned users.

Step 3: Logic for Task Assignment

Within the Business Rules, implement the logic to determine the assignment group for Tasks 3 and 4. You can retrieve the assigned users from the custom field on the HR case record and use this information to determine the assignment group for the subsequent tasks.

Example Business Rule Logic:

  • If Task 1 is completed and assigned to person X from group A, then Task 3 will be automatically assigned to person X.
  • If Task 2 is completed and assigned to person Y from group B, then Task 4 will be automatically assigned to person Y.

Note:

Ensure that the Business Rules are designed to trigger appropriately when Task 1 or Task 2 records are updated. Also, consider any additional conditions or validations required to handle different scenarios effectively.

By following this approach, you can automate the assignment of Tasks 3 and 4 based on the individuals assigned to Tasks 1 and 2 in ServiceNow.

Regards,
Masoom

James Chun
Kilo Patron

Hi @Michael94,

 

You can do this via Assignment Rules and some script.

For example, it will be something like below (haven't tested it FYI)

  • Table: HR Task
  • Condition: HR Service = 'your service'
  • Script:
var hrTask = new GlideRecord('sn_hr_core_task');
hrTask.addEncodedQuery('parent=' + current.parent); //modify your condition as needed
hrTask.query();
if(hrTask.next())
{
current..assignment_group = hrTask.getValue('assignment_group')
}

 

Hope that helps, cheers