This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
When designing a Master and Detail (sometimes known as Parent and Child) setup we will often see dependencies on data between the Master and Detail items. Usually we will also implement a change in the execution of actions to increase performance, or even to get the form to work on Offline Mobile as this does require we run actions in a batch.
See Section Rules, Events, and Actions:
However, without the proper configuration this design could cause errors when executing multiple SmartObject calls in a batch or any other set of actions that requires data from the initial (Master) data set to be transferred to the second (Child) data set.
Before You Begin
- Pinpoint where this behavior will be showing across your forms.
- Confirm that if you have the actions executing one after the other ("then") that we see our expected behavior. And swapping to executing in a batch would cause errors.
- Confirm that your data passing is not done via SmartObject property values being passed. E.G. Parameters or control values instead of the SmartObject values.
- You might be getting an error similar to the following depending on your current configuration on the rules:
In order to get this configuration to work with executing rules in a batch, we will need to ensure that the data is passed between our calls via SmartObject values. It is currently not supported to pass this data for batch calls via the data contained within controls on the form/views. There is an existing feature request in place to be able to use controls. Let's take an example that I have a Parent/Child configuration on my form. The Child SmartObject will have a key for the ID of the Parent. I then have the submit button do the following:
- Create a parent Item
- Start a workflow and pass the Parent ID to a data field for that workflow
- Create a child item.
In order to get this to work I need to do the following:
1) On the first Parent SmartObject call, we must set the output mapping for the ID to the ID property on that same Parent SmartObject. This will load/cache the SmartObject values with those that pertain to the ID we passed.
2) On the start Workflow step, we must pull the ID from the Parent View > Parent SmartObject > ID to get this to populate a data field with that ID of the entry just created in our initial step.
3) On the second Child SmartObject call, we need to do the same thing and pull the ID from the Parent View > SmartObject > ID.