The parent-child records described here are both custom NetSuite records. The parent record can have a one-to-many relationship with the children, similar to an item sublist on a sales order.
For more information, see the NetSuite help article “Establishing a parent-child relationship” found at SuiteCloud platform > SuiteBuilder (customization) > Custom records > Parent-child record relationships.
Contents
Example records
Let’s look at one such record and its structure before trying to map it in integrator.io:
Here, we have custom records called:
- Celigo Inventory Comparison, the parent record
- Celigo Inventory Comparison Line, the child record
You can create additional child records for the single parent record, hence the 1:many relationship.
Importing parent-child records
Import both parent and child records
To understand how to add a parent and its associated children, let’s first look at the relationship as represented in sample JSON source data:
[ { "adjustmentlocation": "New York", "date": "10-10-2020", "subsidiary": 3, "lines": [ { "3plquantity": 5, "location": 7, "netsuiteitem": "LOT00001", "netsuitequantity": 6, "variance": 1 }, { "3plquantity": 8, "location": 7, "netsuiteitem": "LOT00002", "netsuitequantity": 11, "variance": 3 } ] } ]
Here we have two lines, with items LOT00001
and LOT00002
, which are children of the parent record with "subsidiary": 3
and "adjustmentlocation": "New York"
.
Now, let’s map these records in a NetSuite import:
- In Flow Builder, create an import by clicking Add destination/lookup.
- Select NetSuite for the Application, choose to import records using a NetSuite connection, and click Next.
- Select the parent custom record, Celigo Inventory Comparison in this case, for the Record type.
- Save the new import.
Now we can add the parent and child record mappings:
- On the new import in Flow Builder, click the Import mapping ( ) button.
- Map each body-level field, such as
adjustmentlocation
, for the parent record from the export field to NetSuite. - Map each child record field, using the JSON path, such as
lines[*].netsuiteitem
, to the corresponding NetSuite line item field.
- Save and close the import mapping.
When you run this flow, integrator.io will create the parent record in NetSuite and attach the child records directly to it.
Adding children to an existing parent record
If you instead just want to add the child records to an existing parent record, you can also accomplish that task in a separate import. Continuing with the example above, let’s assume exported data that contains a JSON object with the following child records:
[ { "3plquantity": 5, "location": 7, "netsuiteitem": "LOT00001", "netsuitequantity": 6, "variance": 1, "parentId": 1000 }, { "3plquantity": 8, "location": 7, "netsuiteitem": "LOT00002", "netsuitequantity": 11, "variance": 3, "parentId": 1002 } ]
The parentId
value refers to the parent record’s InternalId field. If the InternalId isn’t included in your flow’s data – perhaps it contains a different field such as the parent’s name that uniquely identifies the record – you can perform a dynamic lookup on the parent record to get the record ID.
To map the child records, create an import in Flow Builder to add the record Celigo Inventory Comparison Line (similar to the initial steps in Import both parent and child records, above).
Next, add import mappings for each child field:
The field parentId
is mapped to the key connecting the two records, Parent
. You can identify this field by looking at the record definition in NetSuite and finding where Record is parent is checked.
Comments
0 comments
Please sign in to leave a comment.