XConnect: Concurrency token must not be specified for new entities

If you're new to XConnect you may run into this issue when adding interactions to a contact. You'll probably have code similar to this:

using (Sitecore.XConnect.Client.XConnectClient client =
                Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient())
            {
                var outcome = new Sitecore.XConnect.Outcome(definitionId.Guid, DateTime.UtcNow.Date, "USD", monetaryValue);
                var contact = _contactRepository.GetXConnectContactFromTracker();
                var interaction = new Interaction(contact, InteractionInitiator.Brand, channel, "Web");
                interaction.Events.Add(outcome);
                client.AddContact(contact);
                client.AddInteraction(interaction);
                client.Submit();
            }

The above code will give this exception:

Concurrency token must not be specified for new entities

To fix the issue just remove the client.AddContact(contact); line. The contact is added via the interaction.

XConnect: Concurrency token must not be specified for new entities
Share this