cancel
Showing results for 
Search instead for 
Did you mean: 

Approval process with approvers loop by division

edsonrichter
Confirmed Champ
Confirmed Champ
I've a buy opportunity that can be shared between several divisions of the company.
So, to complete the buy, I need at least one approver from each division to accept the offer.
All approvers will have same profile or permission, but each one in own's division.
Can I make a loop to sequencially ask approvers for acceptance of the offer?
Or can I throw new approval task for each division as part of the start process?
Can I estabilish that task executor (approve offer) is a formula (like ${"approver:"+current_division})?
Is that feasible (I mean, a process with tasks that will vary based on the number of divisions)?
Would I need to customize the process after loading it from the XML? I hope not, I hope to be able to solve using scripts…
Can you help me on how can I model this process?

Thanks in advance,

Edson Richter
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Edson,

Can I make a loop to sequencially ask approvers for acceptance of the offer?
Yes, (seqential/parallel)
http://activiti.org/userguide/index.html#bpmnMultiInstance

can I throw new approval task for each division as part of the start process?
can I throw new approval task for each division as part of the start process?
Clarify, pls

Is that feasible (I mean, a process with tasks that will vary based on the number of divisions)?
Yes

Would I need to customize the process after loading it from the XML?
No, just change params.

Can you help me on how can I model this process?
org.activiti.engine.test.bpmn.multiinstance.MultiInstanceTest

Regards
Martin

Point is, when at design time (of the process), I don't know how many users (roles) will be required to approve the order.
Depending on the purchase request I'll know how many approvers will be involved.
For example, consider the following table:

[table]
  [tr][td]Division[/td][td]Qty[/td][td]Amount Us$ [/td][/tr]
  [tr][td]Ab1[/td][td]100[/td][td]1500.00[/td][/tr]
  [tr][td]Bd7[/td][td]150[/td][td]1750.00[/td][/tr]
  [tr][td]Xy2[/td][td]200[/td][td]3000.00[/td][/tr]
[/table]

Now, this information is in place in the Purchase Request.
So, for order approval, I need some manager or manager-assistant from each division (from the purchase request) to approve the order (sequentially or not).

So, the profile that is allowed to approve is "manager" or "manager-assistant", but the order is really approved only after the three (in the example above) have approved the order.

For other purchase request, I would have only one division, and for other purchase request I can have 10 divisions.

So, at design time, I have no control on which users are required to participate in the approval process - only at run-time I'll know, based on the information available in the purchase request.

In time: one purchase request would have requests from several divisions and will become one order.

edsonrichter
Confirmed Champ
Confirmed Champ
Forget, the solution is quite simple: RTFM.
Since I've reading, I've learned the right way for doing this kind of dynamic tasks (without dealing with complex programming solution):



<userTask id="approvalTask" name="Manager approval" activiti:assignee="${assignee}">
  <multiInstanceLoopCharacteristics isSequential="true"
     activiti:collection="${myService.resolveUsersForTask(currentObject)}" activiti:elementVariable="assignee" >
  </multiInstanceLoopCharacteristics>
</userTask>