Get Assigned WorkItems

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Process wizard > Business Rules > Business Rules examples > Cases and activities >

Get Assigned WorkItems

Overview

Bizagi offers a function where you can obtain an array of the WorkItems assigned to a given user.

 

To obtain a user's assigned WorkItems use the following function:

 

CHelper.getAssignedWorkItems(Me, CaseId, CurrentAssigneeId, IncludeSubProcesses)

 

The following attributes are needed:

Me: Fixed value.

CaseId: Case Id

CurrentAssigneeId: The current assignee's id

IncludeSubProcesses: If you wish to include Sub-processes set this parameter as true.

 

Example

In the following sample rule, we'll be obtaining the creator user's assigned WorkItems for a simple process. This rule is executed On Enter for the task Simple Example.

 

getAssignedWorkItems01

 

The code is as follows

var myWorkItems = CHelper.getAssignedWorkItems(Me, Me.Case.Id, Me.Case.Creator.Id, false);
for(var i=0;i<myWorkItems.Count;i++){
  var Newrecord = Me.newCollectionItem("SimpleProcess.AssignedWorkItems");
  var workItem=myWorkItems[i];
  Newrecord.setXPath("TaskName",workItem.Task.DisplayName);
}

 

The collection is shown like this:

 

getAssignedWorkItems02


Last Updated 1/6/2022 4:13:53 PM