Answered

Using 'Me' functions in Custom Job Rules

Hi Bizagi,

I have added a Custom job in the Bizagi Studio in where I create new cases for a specific process at the beginning of every week.
To get this done I need to now how many records there are in the 'Employees' Stakeholder Entity, in order to know how many new cases should be created.
First I tried this function:



var Filter = "bActive =" + true;
var employees = Me.getXPath("entity-list('Employees','"+Filter+"')");


I retrieved an error on 'Me', because Custom jobs has no process context, so there is no 'Me' defined.
So I tried to look for a replacement for this function, but till now none of them worked out. I have tried:



var Filter = "bActive =" + true;
var employees = CEntityManager.getXPath("entity-list('Employees','"+Filter+"')");
AND

var Filter = "bActive =" + true;
var employees = CEntityManager.GetEntity("Employees").GetEntityList("","",Filter,"");


Both functions returned errors ("CEntityManager does not have such a member") and the last option is actually also depreciated in version 11, so I am not sure if it is still okay to use it.


Can you help me out with this?


Best regards,
Bo

Comments (1)

photo
1

Dear Bo,

There is “GetUsersForStakeholder” function which returns a list of users for a given Stakeholder (Loanofficer in this case).

Here is the script to print Loan Officer’s full name in a Trace file.

var loanOfficers = CHelper.GetUsersForStakeholder("Loanofficer");

for(var i=0; i< loanOfficers.Count;i++){

var fullName = loanOfficers.getXPath("associatedUser.fullName");

CHelper.trace("LoanOfficer", "FullName:"+ fullName) ;

}

Hope this helps!

Regards