cancel
Showing results for 
Search instead for 
Did you mean: 

Loop block keeps adding users to a role

Former Member
0 Kudos

Hi,

This is my GP process

Process

Block Main

Action Approve

Block Expert

Action Assign Users to Process ... (Role "Expert")

Action Opinion (Role "Expert")

Block Main is a loop block so that block "Expert" is called until action "Approve" decides otherwise.

In block "Expert" I assign a user (selected in action "Approve") to the role "Expert" (the collable object is "Assign User to process role) and

then that user has to deal with action "Opinion".

This is working fine but has one problem.

The users I assign to role "Expert" are added up. This means that every time an expert is assigned

and block "Expert" is executed not only the new user but also all users ever assigned before to role "Expert" have access to action "Opinion".

Action Opinion is based on a WebDynpro collable object. So at the end of action "Opinion" I have added

_executionContext.getProcessRoleInstance().removeUser(

WDClientUser.forceLoggedInClientUser().getSAPUser());

But this didn't help.

Please advise.

Thank you very much, Olaf

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Olaf,

GP have restriction that users could not be removed from process role after process instantiated.

I don't know exactly in regard of NW04, but for GP 2.0 NW04s it is known restriction.

It is because business workflow does not support this operation.

Best regards,

Aliaksei.

Former Member
0 Kudos

Thank you for your answer Aliaksei.

If the WD coding cannot work, how else can I avoid that the users are added up per role?

Does anybody have an idea?

Former Member
0 Kudos

Hi Olaf,

To me it seems like you don't want to deal with roles here. It's more like you want to deal with individual users. How do you pick the Expert?

It makes some sense that you can't remove a user from a role after the user executed in that role.

If you can restrict the number of Experts to a small number you could just "un-roll" the loop and create a separate role for each expert (e.g. Expert1, Expert2, Expert3).

If not you might need to split your process into two processes: Main process and expert opinion process. Then you are free to assign only one person to the Expert role for each opinion process.

I do not know how to integrate the results of opinion process into the main process, though.

Please post your solution if you find one.

Cheers

Markus

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Dipankar,

Initially we thought that only Parallel Dynamic Block allows

for Role user assignment with "Filled From Context Parameter";

now I tested with other Conditional Loop Blocks and they also allow

for that, which solved our problem.

Thanks a lot for your valuable information !

Ying-Jie Chen

former_member4529
Active Contributor
0 Kudos

Hi Yingjie,

Yes any type of block supports runtime processor assignment. Only condition is your CO must have an input parameter of type string.

Thanks,

Dipankar

Former Member
0 Kudos

Hello,

We are facing the same issue now with GP on NW2004s SP09. We want

to dynamically add/remove users from a particular role after the process

is started. Experimenting with GP API, it yields that

IGPProcessRoleInstance.addRuntimeDefinedUser (IUser user) does work;

whereas removeUser(IUser user) and removeRuntimeDefinedUser(IUser user)

does not.

The business case is that we need to have multiple level manager approval

and the levels are determined after the process is initiated. Ideally we'd like

to model this as a post-conditioned loop block with manager approval steps

inside. After approval step is completed, the current manager is replaced

with next-level one and loop back.

Have any one any idea how this can be done with GP API calls ?

Many thanks,

Ying-Jie Chen

former_member4529
Active Contributor
0 Kudos

Hi,

Runtime assignment of processor of roles and looping steps are very much possible in GP. Currently I'm writing a help doc on the same scenario and shall publish it soon in SDN. Till that time I can explain you in brief how to achieve this:

Use a pre-conditional loop block to do the approval in a loop. You also need to have a decision action to check the looping and decide where to stop. For that you can use a business logic callable object where you can compare the current level of approval and the total levels of approval required. Accordingly you can set the resultstate of the business logic CO as continue or break. In the loop body block have the approval action and corresponding CO.

For runtime assignment of processor select the parent block of the action and open the Roles tab. There beside each action you can set Runtime defined and a checkbox will appear "Fill from context parameter". Select that and you can select a string input param of the CO if present, which will specify the the processor of that action at runtime.

Thanks,

Dipankar