Contact Us

January 22, 2025

June 18, 2026 11:51 am

Resolving duplicate rows in contact builder with primary key changes

Share with

Understanding the Issue

This issue has been reported by several users, and it appears to be related to the use of datetime as a primary key, which can lead to unexpected behavior when editing records.

A community member asked about this issue, and others confirmed that they have also encountered similar problems, with some cases dating back several years.

Platform-Level Explanation

The root cause of this issue is not entirely clear, but it seems to be related to how Contact Builder handles primary key values when editing records.

It is possible that the issue is due to a bug in Contact Builder that causes the primary key value to be recalculated when a record is edited, even if the primary key field itself is not changed.

This can lead to unexpected behavior, such as duplicate rows being created with new primary key values.

Fixing the Issue

To avoid this issue, it is recommended to use a different field as the primary key, such as a unique identifier that is not based on datetime.

Additionally, teams can try to avoid editing records in Contact Builder, or use a custom solution to prevent the primary key value from being changed.

It is also important to note that Salesforce is aware of this issue and is investigating it, but it is currently classified as a Priority 3 bug.

Step-by-Step Solution

To resolve this issue, teams can follow these steps:

example.code

// example code to prevent primary key changes// use a custom solution to prevent primary key value from being changed

By following these steps, teams can avoid the issue of duplicate rows being created with changed primary key values in Contact Builder.

Checklist

Best Practices for Contact Builder

  • Use a unique identifier as the primary key that is not based on datetime
  • Avoid editing records in Contact Builder whenever possible
  • Use a custom solution to prevent primary key value from being changed
  • Monitor the Salesforce issue tracker for updates on this bug
  • Test and validate any custom solutions thoroughly

Frequently Asked Questions

What is the root cause of this issue?

The root cause is not entirely clear, but it seems to be related to how Contact Builder handles primary key values when editing records.

How can I avoid this issue?

Use a different field as the primary key, and avoid editing records in Contact Builder whenever possible.

Is Salesforce aware of this issue?

Yes, Salesforce is aware of this issue and is investigating it, but it is currently classified as a Priority 3 bug.

Can I use a custom solution to prevent primary key changes?

Yes, teams can use a custom solution to prevent the primary key value from being changed when editing records in Contact Builder.

Genetrix Technology · Salesforce Marketing Cloud Partner

Need help shipping this in production?

Genetrix builds and untangles Salesforce Marketing Cloud and Agentforce setups for teams that want it done right the first time. If anything in this post sounds familiar, talk to us before it ships.

Get in Touch with Genetrix →

Blogs for the

Business-Savvy!​

Let’s Connect

A 30 min no cost strategy session
with cloud support expert

Let’s Connect

A 30 min no cost strategy session
with cloud support expert