Get Assigned WorkItems

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business rules examples >

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, CurrentAsigneeId, IncludeSubProcesses)

 

The following attributes are needed:

Me: Fixed value.

CaseId: Case Id

CurrentAsigneeId: The current asignee'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