To implement this solution using Power Automate for a model-driven app with a parent-child relationship, here's a step-by-step approach:
You want the flow to trigger whenever a new parent record is created or updated. You can use the Common Data Service (Dataverse) connector to trigger this event.
Number of Items
exists).Number of Items
value from the Parent recordOnce the trigger runs, you'll need to get the value from the Number of Items
field of the parent record.
Number of Items
field.Number of Items
Now that you have the Number of Items
, you'll create a loop to generate the required child records.
Action: Use the Initialize variable action to create a variable of type Integer that holds the count from the parent record (this is the Number of Items
field).
Action: Use the Apply to each action to loop through the child records you want to create. You can use an array for looping, such as a range from 1
to the number of items.
You can create a list of numbers (1, 2, 3, 4, etc.) using the Expression to create an array based on the Number of Items
field.
Here’s an expression you can use in the Apply to each loop:
range(1, <Number of Items>)
For each iteration of the loop, you will create a child record.
Inside the loop, use the Add a new row action to create the child record in the related child table.
Number of Items
value from the Parent record.Number of Items
.Position
field to the loop index.Number of Items
might be 0 or empty, as you don't want to create any child records in that scenario.Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.