Multi-instantiate processes from relational data

1
0
-1

(Very new to Bonita, please over-explain any and all advice).

In my process flow, there are orders and items.

The orders have details of the client, delivery dates etc.

The items are the individual parts of the order which are required to be produced, with specifications.

There can be 1 or many items per order.

In the initial section of my diagram, I require that orders and their full list of items are processed together.

However, once the orders are forwarded to production, I wish to only have one item processed at a time.

I want to use parallel multi-instantiation, however it a) wishes me to create a new business variable instead of choosing existing? and b) wants me to choose a 'list'.

Is it possible for me to be able to multi-instantiate on a related table, based on the relational ID field? (Ie, all items from currently processed order ID XXX are instantiated).

2 answers

1
+1
-1
This one is the BEST answer!

Hello Joni,

When you deal with multi-instances initiated with a "Multiple" business object, the context of the UserTask contains information about the multi-instance.

I have designed a process with a human task multi-instanciated by providing a Multiple containing 3 elements.

Note: the MultiInstanceItem is the name of the business object I've created but it can be anything that matches your business requirements.

When executing the process, I get 3 UserTasks (1 per item). In the form design of the multi-instanciated human task, I extract from the context (variable auto generated when creating the form from Bonita Studio also accessible via ../API/bpm/userTask/{{taskId}}/context) the information related to the multi-instance:

 "items_ref": { "name": "items", "type": "com.company.model.MultiInstanceItem", "link": "API/bdm/businessData/com.company.model.MultiInstanceItem/findByIds?ids=1,2,3", "storageIds": [ 1, 2, 3 ], "storageIds_string": [ "1", "2", "3" ] },

"multiInstanceIterator_ref": { "name": "multiInstanceIterator", "type": "com.company.model.Item", "link": "API/bdm/businessData/com.company.model.Item/3", "storageId": 3, "storageId_string": "3" }

As you can see there are 2 pieces of information that are useful to me:

  • items_ref is the reference to the business data (multiple) that has been used to create the multi-instance. We can see that it contains 3 elements
  • multiInstanceIterator_ref is the reference to the Iterator within the multi-instance. Each human task get a different value. In the example above you have the Iterator value for the 3rd human task. By extrapolation you can understand that the task 1 get the iterator pointing to the 1st Item, and the task 2 gets the iterator pointing to the 2nd Item.

So using the multiInstanceIterator_ref in your form, you can then display the right Item to your user depending on the task context.

I hope this is clear enough, let me know if you need more details.

Captain Bonita

1
+1
-1

Hi,

I agree that it is currently a pain, but the only way to map your Items on a multi-instantiated task is:

  1. Create a multiple business data of type Items in addition of your order data
  2. Add an operation that set the items multiple data t with an operation that just reference the items from the order
  3. Use the multiple data in the iteration input

Here is a 2021.2 bos example (link expires 28/10/2021)

HTH
Romain

Comments

Submitted by jonigray on Fri, 10/22/2021 - 11:52

This is helpful, thank you!

Heads up that the link is broken (but it would be very useful if you have the time to correct it!).

Submitted by romain.bioteau on Fri, 10/22/2021 - 12:02

Link updated !

Submitted by jonigray on Thu, 02/24/2022 - 09:30

I have another ask for this, how do I refer to the data from the list in a form? I can only seem to display the whole list, rather one item per form.

Submitted by deivith.1 on Thu, 06/23/2022 - 00:22

Hi , could you share again the example please or update the link , it would be helpful for those who just start ,thanks. :)

Notifications