Working with Parent and Child Entities

Varsha Neelesh
Varsha Neelesh
  • Updated

Entities may have relationships with other entities, which can either be direct references or parent-child relationships. In a parent-child relation, the parent entity can exist independently without a child, while the reverse is not true. The creation of a child record necessitates the prior creation of the parent record.

A classic example is the relationship between a Sales Order (parent) and its Sales Order Line Items (child). Line items are associated with a specific sales order. When creating a line item, it requires the sales order ID to be set for each line item.

In Syncari, there are several approaches available for building pipelines to synchronize data for parent-child entities. Let's see a detailed description along with an example.

Using a Single Pipeline

A single pipeline in Syncari can be used to map fields of parent and child entities and sync data. For some synapses like Netsuite, this approach is the only way to implement in Syncari. Netsuite apis provide parent and child data in the same api response payload.

In this approach, there is a single entity called Salesorder created in Syncari. This entity has Sales Order Line Items (salesorderlineitems) as one of its fields.

image (6).png

The datatype of this field (salesorderlineitems) is "child" with multivalued enabled (since it is a list of line item objects).

Screenshot 2024-03-04 at 4.20.50 PM.png

The Field Pipeline for salesorderlineitems looks as shown in the image below.

  • Opportunities are pulled from Salesforce
  • The products associated to the opportunity are looked up from Syncari entity.
  • A loop (Setup Oppty Product Loop) is used to iterate over all opportunity products. For each of these products a sales order line item is created and stored in Syncari.

Screen Shot 2024-03-04 at 8.25.49 PM.png

The below image shows the configuration for Convert to Line Items node. This node creates line items and stores in Syncari.

Screen Shot 2024-03-04 at 8.26.36 PM.png

The line items stored in Syncari now need to be converted to Netsuite line items. The below image shows the configuration for Convert to NS Lines node on the destination side. This node creates line items for Netsuite that can be synced to destination.

Screen Shot 2024-03-04 at 8.26.51 PM.png

Using Multiple Pipelines

A pipeline for each parent and child in Syncari can be utilized to map fields of parent and child entities and synchronize data. This method is particularly recommended for certain integrations like Salesforce. The interdependency between parent and child can be orchestrated within the cross-entity pipeline.

In this approach, two Syncari entities are created: Opportunity and OpportunityProduct. Each entity has its own dedicated pipeline set up in Sync Studio.

Screen Shot 2024-03-04 at 8.29.01 PM.png

The Opportunity Product pipeline looks like shown in the image below - a straight pipeline.

Screen Shot 2024-03-04 at 8.28.47 PM.png

Within the OpportunityProduct entity, the pipeline for the ParentId field (linked to Opportunity) is automatically resolved by Syncari, leveraging its comprehensive set of Opportunity records. Should a OpportunityProduct sync occur prior to the Opportunity, Syncari intelligently waits for the parent record to synchronize before associating the child, ensuring seamless data integrity.

Share this

Was this article helpful?

0 out of 0 found this helpful