CreateWith Block
Use the CreateWith block to write entity records to a target datastore that stores related data hierarchically. You can, for example, use a CreateWith block to process a Sales Order and use the Add block to include the Sales Item entity or children contained in the Sales Order record or parent. See Hierarchical Data.
The CreateWith block adds a new record for a specified entity, and can contain Add blocks to specify data for its children to add records to a datastore. As part of configuring a CreateWith block, you:
- Select the parent entity to use for this CreateWith operation.
- Add supported related entities. See Block Properties Include Tab — Hierarchical Entities.
- Map the fields you want to add to the new target records.
- Configure Error Handling.
The CreateWith block builds an entire hierarchical record and then writes that to the target datastore. When using a CreateWith block and any Add blocks it may contain, no data is written to the target until the end of the CreateWith operation. If you use a standard Create, Update, Delete operation within a CreateWith block, those operations write to the target immediately.
When using a CreateWith block, operation results are only available outside the CreateWith and only for the first level of the hierarchy selected. For example, if in the CreateWith block you selected an entity named Country, only the results for Country are available, not the results for any related children or grandchildren.
Depending on your requirements, you can nest CreateWith blocks. If for any reason there is a conflict where an Add block might be paired with more than one CreateWith block, the innermost CreateWith block takes precedence.
Block Properties — General Tab
From the Block Properties General Tab, you can change the Block Label, add a description, and select the parent or top level entity to use for this operation.
Block Properties — Include Tab
For target blocks that support hierarchical data, use the Include tab to select related entities that you wish to write to the target datastore. For example, if your hierarchy is Country, State, City, Business, and the entity selected for this block is Country, select State, City, and Business to indicate that you also want that data for each Country. To include the related child information, use a combination of the For Each Child Block and Add Block inside this block. See Block Properties Include Tab — Hierarchical Entities.
Block Properties — Fields Tab
From the Block Properties Fields Tab, you can:
- Create links between source and target data fields, including fields from the relationships that you specified in the Query Block or Fetch Block:
- Source fields from parent entities are available in all Blocks.
- Source fields from child entities are only available within a For Each Child Block for that child relationship. See Mapping Hierarchical Data Fields.
- Target fields for entities with one to one relationships with the entity selected on the General tab display only if the related entities are selected on the Include tab for the target operation Block, such as CreateWith or UpdateWith.
- Use the SmartMapper service to help you link selected source and target fields. You may need to clear some fields linked by SmartMapper, such as any modifiedon or createdon datetime fields. See SmartMapper.
- Create simple or complex formulas to transform source data. See Formula Editor Overview.
- View detailed information about any field in your source or target using the Info icon .
When using the Fields tab, you can:
- Use column filters to find specific data in the source or target pane as described in Using The UI Filters.
- Select any column head to sort all fields in the pane by that column.
For detailed information about using the Fields tab, see Block Properties Fields Tab and Mapping Hierarchical Data Fields.
Block Properties — Error Handling Tab
Use the Error Handling options to enable or disable processing this record when a block operation encounters a problem. For the CreateWith block, errors can be logged when an operation fails. See Block Properties Error Handling Tab for additional information.
If this setting is checked, an error from any part of the data, parent or child, generates a record error and no more blocks execute for that record. If the setting is unchecked, no error is written to the log and the flow continues running with the text of the error available in the Result Fields.
Block Properties — Errors And Warnings Tab
If there are any errors or warnings for this block, the Errors and Warnings tab displays the number of errors or warnings in the tab name. See Block And Flow Errors And Warnings.
Once you have corrected the errors, select the Validate button to update the Errors and Warnings tab.