Recently i had to deal with a duplicate key error which was caused by a email activity inside a journey that somehow made me question a whole approach i have set up for templates and email across a whole business unit.

The Error:

Email Triggered Send Job Error An error occurred when attempting to evaluate a ContentBlockByKey function call. Function Call: ContentBlockByKey("SERVICE_BLOCK_2021") See inner exception for details.

More Detailled error from Support:

"Cannot insert duplicate key row in object 'dbo.JobContentBlock' with unique index 'IX_JobContentBlock_JobID_ListID_CustomerKey_u'. The duplicate key value is (1029680, 358, SERVICE_BLOCK_2021)."

We have dynamic ContentBlocks or AMPScriptBlocks that output content. I do not put these blocks directly into the template. I am using ContentBlockByKey("KeyName") to reference these ContentBlocks (in this example SERVICE_BLOCK_2021). When i have to change these ContentBlocks i usually try to edit them in one go. Unfortunately sometimes this is not possible because the new block has a different layout or something similar (original content block not raw html). That's when i create a new content block and swap the KeyNames of the existing and the new block as fast as possible. And that's when this error occured.

Do you guys have more details about dbo.JobContentBlock and the snapshotting of journeys? Do you have a suggestion what i can do better?

This is a topic where you rarely find details. Sometimes its not even clear if snapshotting is done on a journey level or on a job / activity level.

1 Answer 1


So, from my understanding Snapshotting is done in multiple different ways depending on context.

For instance,

  • In Journeys, there is the snapshot of the data at entry for 'Journey Data'
  • In User Initiated Emails and Email Wizard sends, once the job is scheduled, it will run through all the relevant content blocks and functions to preprocess as much as it can without utilizing data references as it can to help expedite the send processing
  • In Triggered Sends/Journeys, it will do the same as User Initiated and Email Wizard sends at publish/start. This will then remain the same until it is published again.

Long story short from the above, all snapshots related to content are done at a job level (Scheduled send and Published Trigger/Journey Email) so you need to create a new job and cancel current to alter this snapshot. This includes Dynamic Content Blocks, Reference Blocks and AMPscript/SSJS contentblock functions.

So if you were to have the same email that has the same Content block reference to 'MyContent' key but you want to change the actual display in 'MyContent' to use a different block. By altering the key from 'MyContent' to 'Archive-MyContent' and changing the new block to 'MyContent' will not switch this out. BUT, as you have found, it can cause unexpected behavior and errors - especially if the original block is deleted or 'unshared'.

You would need to edit the email inside of Journey Builder or manually Pause/Republish/Restart each trigger for each of these changes in order to ensure updates.

Other option is to house the contentblockkeys inside of a DE or other data source and do a lookup for this info (forcing it to rely on sendable data so it does not preprocess) but be careful here as it can slow down processing and throughput.

  • 1
    I will continue the support case with salesforce. But i really thank you for your input. For now i will mark this as the final answer ;) Jul 14, 2021 at 6:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .