Skip to main content Skip to complementary content

Relational objects

This pattern describes how to use the CDP to sync relational data, e.g. contacts (child records) linked to companies (parent records).

Source to CDP

When upserting a child record in the CDP, check if the parent record exists first. If not create the parent in the CDP. Next, upsert the child records in the CDP and make sure to link the child to the parent in the CDP.

CDP to destination

We describe two different patterns to sync child records from the CDP to a destination.

Create parent in destination if not exists

Check if the parent was already created in the destination, based on its external_id in the CDP. If that is not set, create the parent first in the destination.

Next, upsert the child in the destination and make sure to link it to the correct parent in the destination.

Retry automation if parent missing in destination (only for webhooks)

When using a triggered automation (CDP Webhooks), you can use the Retry block in case the creation of an object in the destination fails due to the parent record not being available yet.

This can happen when using Webhooks and is called a racing condition. The automation that creates the parent record in the destination (e.g. a Company) may not have been executed yet when the Contact is created. In that case, the Retry block will keep trying to create the Contact, and this will succeed once the Company is created.

Example:

The Retry block in use.

an automation consisting of an On Attendee Created block and a Condition block, which accesses a Get Event block and a second Condition block when the trigger is not coming from the destination platform. The second Condition block accesses a Retry automation block if the parent record's destination ID is missing in the CDP, and an Output block if not.

The above example automation listens for new Attendees in the CDP. As always, it will check if the event is not caused by the automation itself. Next, it will get the parent record (Event) from the CDP:

Getting an id.

The Input tab of the Get Event block. Id is set to On Attendee Created > Entity > Event Id.

The automation will check if the parent record exists in the destination. This is done by checking the destination id in the CDP:

Checking for an id in the destination.

The Inputs tab of the second Condition block. It checks whether Get Event > External Ids > Some Destination Platform is empty.

Raw path of destination id in CDP:

{$.getEvent.external_ids.some_destination_platform}

If this id is not set, this means the foreign key (the event id in the destination) is not known, and the automation will be retried later on:

Inputs for the Retry block.

The Inputs tab of the Retry automation block. Max runs is set to 15, and Retry delay is set to 30.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!