Skip to main content
Hey ppl,

I have the following requirement:

An employee can raise a request for a cash advance. If the advance amount is <$100, it will have to go for approval to only one person(say his manager-person 1).

If the amount is >$100 and <$200 it will have to go to person 1 and person 2.
If the amount is >$200 and <$300 it will have to go to person 1,person 2 and person 3.
and so on...

These approvals are to be done in parallel. In short, the number of parallel approvals that would be required is variable.

How can I go about designing a workflow for this situation. Does K2 support dynamic creation of activities or parallel instances?

I hope I have made my requirement clear. Hoping to get a response soon!

Regards,
Midhun

Hello Midhun,


Did you get a solution for your problem? I am also looking for something similar.


Hi All,


We are also having the similar kind of requirement. Any one got solution for this?


Thanks In Advance.


 


Regards,


-Balaji. S


Hi,


There is a way to do this, but it is a little complex as it involves IPC calls and separate workflows.


Where several parallel activities are required, create an activity using the Plan per slot destination planning option. Use a field from your process/Smart Object to determine how many parallel approvals will be required. Inside the activity configure an IPC event to call another process which will handle the approval. Configure this as Synchronous so that it waits for all approvals to complete. If you choose a field which brings back all the destination users which will be required, you can send the ActivityDestinationInstance.InstanceData to the child process so that you can use the correct destination user in the child. Configure the Activity's Succeeding Rule to wait until all approval events have been completed (ActivityDestinationInstance.Status = Completed).


In the other process have a client event configured which has its destination configured as a data field (which was passed in from the parent).


In this configuration a new process with a Client Event will be started as many times as necessary and all of these will be executing in parallel.


If the plan per slot configuration is a bit confusing, look at the following post: http://www.k2underground.com/blogs/blackbelt/archive/2011/09/02/scheduling-a-workflow-on-several-list-items.aspx. The post does not describe your configuration specifically, but it will give you some guidance on how to configure Plan per slot and how to work with the Instance Data which gets generated for each slot.


I hope this helps!


This appears to be a blackpearl solution. This is the K2.net 2003 Solutions forum. Is there a way to do this in K2 2003?



Hi,


There is a way to do this, but it is a little complex as it involves IPC calls and separate workflows.


Where several parallel activities are required, create an activity using the Plan per slot destination planning option. Use a field from your process/Smart Object to determine how many parallel approvals will be required. Inside the activity configure an IPC event to call another process which will handle the approval. Configure this as Synchronous so that it waits for all approvals to complete. If you choose a field which brings back all the destination users which will be required, you can send the ActivityDestinationInstance.InstanceData to the child process so that you can use the correct destination user in the child. Configure the Activity's Succeeding Rule to wait until all approval events have been completed (ActivityDestinationInstance.Status = Completed).


In the other process have a client event configured which has its destination configured as a data field (which was passed in from the parent).


In this configuration a new process with a Client Event will be started as many times as necessary and all of these will be executing in parallel.


If the plan per slot configuration is a bit confusing, look at the following post: http://www.k2underground.com/blogs/blackbelt/archive/2011/09/02/scheduling-a-workflow-on-several-list-items.aspx. The post does not describe your configuration specifically, but it will give you some guidance on how to configure Plan per slot and how to work with the Instance Data which gets generated for each slot.


I hope this helps!




 


I have not used this but used the limit slots to 2 concept for parallel approval.


For K2 .NET 2003: (but similiar concept can be applied to Blackpearl without using IPC)


For an unknown number of slots, use create a slot for each destination.


In destination rule assign the appropriate number of approver to destination based on dollar amount.


In server event of the activity you probably want to gotoactivity to somewhere if it's REJECT.


In SucceedingRule for the activity:  count the number of approved and check against the number of approvers that should be approving (you set that # somewhere in the process when the dollar amount is known).


Public sub Main(ByRef K2 As SucceedingRuleContext)

    Dim Counter As Integer = 0
    Dim iSlots As Integer = 0
    Dim ActInstDest As ActivityInstanceDestination

    For Each ActInstDest In K2.ActivityInstance.Destinations
        If ActInstDest.Status.ToString.toupper = "COMPLETED" Then
            Counter += 1
        End If
    Next


 


'for my case I stored the actual approver in separate data fields since I know the maximum number of approvers.   For dynamic you would need to store the approved count somewhere (without getting collision from approving at the same time)



    If k2.processinstance.datafield("ApproversRequired").Value = Counter Then
        K2.SucceedingRule = True
    Else
        K2.SucceedingRule = False
    End If

End Sub


Reply