Normally a parent record is created first (e.g. Orders), then child records are added one at a time (e.g. Line Items)-- using two different forms, and saving after each entry.
Using the method below, multiple child records can automatically be created based on EnumList values in the parent record, using only 2 actions sent from the device. A single Order form can be saved, automatically creating as many Line Items as needed.
I’ve set up a Sample App to demo the technique.
Note that you’ll have to copy the sample to see it in action, since the public sample won’t save changes.
The key to dynamically creating as many records as needed is pairing the EnumList with a set of Master Line Items. Then a workflow action uses execute an action on a set of rows to copy all the Master Line Items to the new Order, but only IF they were selected in the Order’s EnumList.
- The user must update each Line Item after creation to adjust the quantity. I’m currently autofilling [Quantity]=1, but any default could be programmed.
- New Products will need new Master Line Items created to keep the Order EnumList populated with all options. With a little more work this could be automated but I wanted to keep it simple for the demo.
This can be done with fewer actions and no workflow, but then every child record counts as a new change to be synced.
In my testing, the 2 changes took longer to sync than a regular row edit, but it was still considerably faster than creating each row from the device.