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 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:
The automation will check if the parent record exists in the destination. This is done by checking the destination id in the CDP:
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:
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!