Answered
scripting boolean in business rule
Hello,
I created the Expression below to check if the current user is the lastone of an array and if yes it should return true. apparently the code below doesnt work. can u help me out?
false;
// Create an array
var Users = new ArrayList();
var userID = Me.Case.WorkingCredential.UserId;
// Get all users
var SearchUsers = CHelper.GetValueAsCollection(<Entscheidungsprozess.Empfanger[NutzerID != null]>);
// Count how many users comply
var HowManyUsers = SearchUsers.size();
if(HowManyUsers > 0)
{
// Add each user to the array
for (var i=0; i < HowManyUsers; i++)
{
var idUser = SearchUsers[i].getXPath("NutzerID");
Users.Add(idUser);
}
}
if(SearchUsers[HowManyUsers-1] == userID){true;}
Dear Max
We looked at your scipt and it seems like the last statement in your script needs to have .getXPath("NutzerID").
So it probably should be as below:
if(SearchUsers[HowManyUsers-1].getXPath("NutzerID") == userID){true;}
Also you can put Trace statements to see the values you are comparing.
Please refer to following article for enabling Tracing:
http://help.bizagi.com/bpm-suite/en/index.html?studio_tracingconf.htm
http://help.bizagi.com/bpm-suite/en/index.html?validating_my_business_r.htm
Best Regards
perfect! thanks!
Comments have been locked on this page!