About Me

About Me
Working with SOA technologies , implementing solution using IBM BPM , IBM Integration Designer,IBM WODM and IBM DataPower

About me

View Mahesh Dondeti's profile on LinkedIn

upcoming posts on IBM Bluemix,Devops,Worklight,Node js.

Saturday 18 October 2014

How to filter users in a team using “Team Filter Service” in BPMv8.5.x.



Scenario:

How to filter users in a team using “Team Filter Service” in BPMv8.5.x.


LoanReviewBPD:-
 

Loan Review BPD process loan application submitted by application by sending it to review officer.”LoanApproveOfficers” lane was assigned Team1 which contains reviewers list. Here condition is “Loan Application Reviewer1” and “LoanApplicationReviewer2” task  have to perform by different users

In our example Team1 contains “User1”,User2” and”Admin” users, If  Loan Application Reviewer1 task completed   by “user 1 “, LoanApplicationReviewer2 task have to performed by either “User2” or ”Admin”




Creation Of  Team Filter Service:-
                
·         Create an integration service by  choosing template as “TeamFilterService”
·         Add  input variable called “userfilter” to filter team  based on the user.
·         Add server script to service add below code .

var origTeam = tw.system.org.findTeamByName(tw.local.originalTeam.name);
                 var allUsers = origTeam.allUsers;
                
                 // compute result team members
                 log.info("************Last Completed User ****"+tw.local.userFilter);
                 var resultTeam = new tw.object.Team();
                 resultTeam.members = new tw.object.listOf.String();
                 var userCount = 0;
                 for(var i=0; i<allUsers.length; i++) {
                     var user = allUsers[i].name;
                     if (tw.local.userFilter != user) {
                     log.info("Added Users %%%%%%%%%%%%%%% "+i+"   "+user);
                         resultTeam.members[userCount++] = user;
                     }
                 }
                
                 // set the result
                 tw.local.filteredTeam = resultTeam;


Add above filter team service to  User task 2 (Loan reviewer 2)  and map  “tw.local.lastuser”  contains user who completed last task  which we passed input to filter team service
 As shown below .









Get last user information by  using ” tw.system.user_loginname” in Human Service of User Task1 and pass it bpd variable “tw.local.lastuser”



 

No comments:

Post a Comment