Somehow I have implemented as follows
Note : the attached process img. is a child process of my complete process
In my process doc. I have created fields for MC (mc/stopperLevel , mc/starterLevel , mc/currentAssignee, mc/currentLevel, mc/maxLevelReached, mc/lastCompletedUser)
First service Init Management Chain does following
- Find stopperLevel for given process (uses Business Rule)
- if starterLevel is greater or equal to stopperLevel it assigns TRUE value to mc/maxLevelReached otherwise assign starterLevel to currentLevel and finds users for this level and populates into mc/currentAssignee.
then Is Top Level Reached checks mc/maxLevelReached
if top level reached (process could complete if starters level is greater or equal than stopper), process will complete
if not Reported Approve Task (this task should assign to mc/currentAssignee) will execute.
After completing UI Task, it should be checked that if it’s approved or not.
If approved (set lastCompletedUser into mc/lastCompletedUser) , then we should find next approver with service Post Approve Task
Post Approve Task does followings;
- Finds reported user of mc/lastCompletedUser, and level of her/him
- assing those values to mc/currentAssignee, mc/currentLevel
- check level of this user with level of stopper and decide if has been reached to max level. If it is so then sets TRUE value to the mc/maxLevelReached.
Hope you’ll find useful