Reassigning a task to a new group

You can use REST APIs and JavaScript APIs to reassign a task to a user, group, or team.

About this task

When a group or team is updated, the associated manager team is also updated. If you assign a task to a team, the team must exist in the version or snapshot scope that is currently associated with the task.

If you are considering reassigning a task to a group, it is generally recommended that you reassign the task to a team from the task's current version or snapshot context.

Note:

If a task is reassigned to a group that is associated with a different version or snapshot than the task, it can cause problems for the version or snapshot deletion. The instructions in this help topic can be used to replace an ad hoc group that might be blocking the deletion.

If a task is reassigned to a group that does not have a manager team, the task's manager team will be cleared. In releases earlier than 20.x, the assigned manager team is only changed when the task is reassigned to a group that has a manager team.

Procedure

To reassign a task to a new team:

  1. Select one of the following approaches:

    • If you want to reassign a task to a new team by using REST APIs, build a client application or use the REST API test tool to perform the required operations. For information about using the REST API test tool, see Testing the IBM BPM REST APIs. You can review the teams for a version or snapshot by using the Designer or the Install Apps tab of the Process Admin Console. The steps that you would follow to reassign a task to a new team by using REST APIs differs depending on the product version:

      • In IBM® Business Automation Workflow 20.0.0.2 and later, use the Task Instance resource PUT (assign task) method to assign the task to the new team. You should pass the name using the toTeam parameter. For example:
        PUT /rest/bpm/wle/v1/task/1234?action=assign&toTeam=HiringManagers&parts=all
        For more information, see REST interface for process-related resources - Task Instance Resource - PUT (assign task) Method External link opens a new window or tab.

      • In IBM Business Automation Workflow V20.0.0.1 and earlier, complete the following steps:

        1. To obtain detailed information about a task, such as its current version or snapshot context, use the Task Instance resource GET method that is described in the topic REST interface for process-related resources - Task Instance Resource - GET Method External link opens a new window or tab.

        2. Obtain the internal team name by running the following SQL query (where 'team_name' is the name of the team that you want to use and 'snapshot_id' is the snapshot ID from the current task context):
          Select g.group_name from LSW_USR_GRP_XREF g, LSW_PARTICIPANT_GROUP t Where g.group_id = t.group_id AND g.display_name = 'team_name' AND t.snapshot_id = 'snapshot_id'

          The snapshot ID is the GUID that follows '2064.' in the task details.

        3. Use the Task Instance resource PUT (assign task) method to assign the task to the new team. You should pass the name using the toGroup parameter. For example:
          PUT /rest/bpm/wle/v1/task/1234?action=assign&toGroup=HiringManagers_S_cd97937f-06ab-43cc-8067-17dea489fdb3.481abfd8-9868-4638-ace0-7932d46958d5&parts=all

          For more information, see REST interface for process-related resources - Task Instance Resource - PUT (assign task) Method External link opens a new window or tab.

    • If you want to reassign a task to a new team by using JavaScript APIs, build a service that is able to run the required JavaScript API methods. The following example shows how task 1234 is reassigned to the team MyNewTeam:
      var task = tw.system.findTaskByID(1234);
      task.reassignTo(task.processInstance.snapshot.findParticipantGroupByName("MyNewTeam").associatedRole);

      For detailed information about the JavaScript APIs, see JavaScript API in processes and service flows External link opens a new window or tab.

  2. Confirm that the task is now reassigned to the specified team.