Mapping Hierarchical Data Fields
When mapping hierarchical data, the type of relationships in the source data and the blocks selected for the flow determine which fields can be mapped.
A parent entity can contain children that are a one-to-one relationship, such as a SalesOrder with a Contact and a Shipping Address. Fields for both the parent and the child display on the Block Properties Preview Tab for a Query or a Fetch block, and on the Block Properties Fields Tab for target blocks, such as the CreateWith Block, the UpdateWith Block, or the UpsertWith Block.
A parent entity can also contain children that are a collection or a one-to-many relationship, such as a SalesOrder with several Items. Fields for the parent display on the Block Properties Preview Tab for a Query or a Fetch block, and on the Block Properties Fields Tab for target blocks, such as the CreateWith Block, the UpdateWith Block, or the UpsertWith Block. To access the fields for the children on the source side, you must use a For Each Child Block. To map fields for child records on the target side, you must use an Add Block.
SalesOrder Example
Assume you need to query the SalesOrder mentioned above and write the data to a target datastore. The images below show how the entities and fields display.
Sample SalesOrder
The Fields Tab for the CreateWith block contains the order information and the shipping information, but does not contain the items in the order.
Fields Tab With Parent Entity And Single Child Entity
To access the fields for the Items, add a For Each Child block inside the CreateWith block. To add the fields for the Items to the target, place an Add block inside the For Each Child block.
Sample Flow To Write Multiple Children
The Fields tab on the Add block contains the fields for the parent entity, the single child entities, and the Items in the SalesOrder.
Fields Tab With One-To-Many Children