Skip to main content

Hi,

 

I have a system that has some activities that needs superior approval.

After the approval, the approver needs to send activities to one or more employees. He has a field on the smartform to identify the employees.

On the same smartform of this function, the user have one field to decide the destination rule, and he can decide if this can be "all at once" or "one at a time". The objective here is to give priviliges to the approver to decide the destination rule dynamically.

So the question is, how to do this? On first analysis we concluded that we must have 2 activities. One for "all at once" and another to "one at time", and before routing the instance of the workflow to one of this activities, we must check the field with the value of the destination rule and make the way by line rules.

It can be made by another way?

 

 

Thank you,

Óscar Gomes

Your first analysis is the easiest approach.  It will also be the most obvious for someone else trying to read/understand your process.

 

But....

 

You can change the destination rules for a process dynamically through code.  You may have to be utlizing Visual Studio as your editor of choice, however (I don't know that this exists in K2 Designer).  Under the hood, K2 utilizes the Windows Workflow Foundation, which in turn utilizes C#.  Right-click on your activity (not the event), then choose View Code > Destination Rule.  This will open the WWF component of the activity.  Right-click on the DestinationRule code activity, then choose View Code.  This will put you into the C# code that governs how the activity is assigned.  From here, you can use the _k2 HostContext object to inspect various properties of your process and make a determination about how the activity should be assigned.

 

If you go this route, you are delving into the depths of K2 that are largely undocumented.  You might be able to find some blog posts about various tasks at this level of the workflow engine, but you are more or less on your own.  There will probably be a lot of trial and error to get the behavior you desire, and I wouldn't put a lot of faith in some sort of K2 update in the future not breaking your customizations here.

 

So as I said...

 

Your first analysis is the easiest approach.  It will also be the most obvious for someone else trying to read/understand your process and easiest to maintain in the long term.


Reply