Remove user from activity destination role on the fly

  • 29 December 2015
  • 4 replies
  • 2 views

Badge +5

How can I remove or block a user from a destination role? I have 2 activities which have the same destination role. However, if a user actionned activity 1, the same user shouldn't get activity 2 in its worklist. (the second activity being an approval stage which shouldn't be actionned by the same user as activity 1).

Any advice would be appreciated (I'm using blackpearl 4.5).

Thanks

Rachel


4 replies

Userlevel 5
Badge +16

Hi,

 

It's not applicable OOB, you can workaround it by:

 

1- Create SQL table (ID, InstanceID, Activity, ActionedBy)

 

on the second activity you when the user try to action it, get the previous activity approver and compare it to the current user, if the current user is not the previous activity approver then submit, else, inform the user with a message of the information you want 

 

2- Create data field on you process and and keep it updated with the user who actioned the first activity and then on the forms (not sure if you're using smartforms) check the datafield with the same condition in step 1.

 

You can achieve this by using custom code in your process if you are using K2 for Visual Studio.

 

wish it helps

 

 

Badge +5

Thank you for that Mustafa, I appreciate you taking the time to respond. I had been hoping to stop the 2nd activity from reaching the work list of the user who submitted activity 1 instead of this user just being prevented from submitting activity 2.

 

Has anyone added custom code to an activity's code behind's Destination Rule (Add Destinations method) to remove a user from the destination (bp 4.5)? The destination of the 2nd activity is a role so I assume the value being added to the Destinations array is a role?

 

Thanks

Rachel

Userlevel 3
Badge +8

Dear ,

 

tryin to figure out the scenario needed here , and i searched couple of articles ,

from wt ive seen , u cant do that unless u try to modify the "code" for destination rule to meet ur requirments ,

but if u dont want to try that , maybe if ur roles/groups has few members 5-10 , it might take some time but u can create 

1st group with all members in it , and 2nd is all members - one members and so on.

and im pretty sure u can send a flag from 1st activity to 2nd activity to indicate which group to use .

Note : the names of groups will be stored in  DB Table , and the destination rule will be set to smartobject list event and filtered by the flag from 1st activity .

 

I hope it helps .

Best Regards.

Badge +5

Thank you Ahmad, that's a great alternative to manipulating the code behind. I will weigh this approach up against the other approach and decide what's the most straight forward to implement and maintain.

 

Thank you both again for you prompt responses!

Rachel

Reply