Fix – Exception in creation of lead (Dynamics 365 Marketing)

We were getting this error in the submission of one of our outbound Marketing forms.

Activity id: e1ede147-efb6-457d-bc19-826c6176a2e4, Request id: jH7xRiEzGFTdZQTbE2fkh9_Z_WtjumCqJERuYZbGSL0_0, Exception: Entity ‘Contact’ With Id = 896b960d-c5d7-4c4d-95c7-a9e226afbf8e Does Not Exist

The form had only the Lead form matching defined and Only leads for Update contacts / leads.

So here because of some earlier multiple/different form submissions, a contact got created and stored in the browser’s cookie, which CRM was referring to, and trying to set a Parent Contact for the lead record even though we were having Only leads set for update contact/leads option.

This is the behavior of the product.

The solution is to delete the cookie or try in incognito or in-private mode or a different browser, and it would work.

This would probably arise because while setting up marketing forms we would do multiple submissions with test data for testing.

Hope it helps..


Fixed – Exception in creation of lead (Dynamics 365 Marketing)

Recently we were getting the below error in one of our marketing forms for form submission record.

Exception in Creation of lead – Activity id: 40ff82fc-bb10-4d30-8671-12683392ccdf, Request id: AsChkx2zn5IKrjHVC4cTb6j-ZkB23D0PqgCdxwi8kEE_0, Exception: An item with the same key has already been added.

This was because we had mistakenly added first name fields twice as the form-matching attribute in the form-matching rule used for that form.

Deleting that extra field resolved the issue for us.

Hope it helps..


How to – enable marketing interactions in lead and contact timeline – Dynamics 365 Marketing

To view marketing interactions, we need to add a custom connector to the timeline of the lead and the contact form. This step is only required if we are using custom forms and not the out-the-box marketing forms for lead and contact.

The OOB Form already has this connector defined.

Open the form for customization, select the timeline control, scroll down to Advanced >> Additional Settings >> Custom connectors, and click on Add connector.

Specify Constructor and Resource Path and save the record.

  • Constructor: msdynmkt_DynamicsMktTimelineInteractionAnalytics.TimelineInteractionAnalyticsResource
  • Resource path: msdynmkt_DynamicsMktTimelineInteractionAnalytics

Save the form and publish it.

We can see the marketing interactions being displayed in the timeline.

Hope it helps..


Moving Marketing Email, Journey, Events, etc. between environments – Dynamics 365 Marketing

To move Marketing configurations/data from one environment to another we can make use of the Configuration Migration Tool.

Open the tool, and create the schema file. Connect to the source environment.

Select and add the real-time marketing email table – msdynmkt_email Soure email.

Next, we are going to select the real-time marketing Journey table – msdynmkt_journey

Source Journey.

Lastly events – msevtmgt_event

Source events.

Click on Save and Export

Save the schema file and click on yes.

Click on Export data to generate the data to be exported.

Next with the schema and data exported, select Import Data to start the import and select destination organization.

Select the data file exported earlier and start the import process.

The import process gets completed with a warning for the table Event for one of the records.

Let us now check the destination environment.

We can see 4 Email records created and 1 updated, all in Draft Status.

We can see all 4 journey records created.

And 2 event records were created.

In case we want to filter the records or want to make sure records are not updated in the destination, we can select Tools >> Configure Import Settings

And use Do not update existing records for all entities and specify Fetch XML for it for filtering.

Also, checkPrerequisites for the export/import process

Hope it helps..


Marketing Form and required (mandatory) fields in Lead and Contact – Dynamics 365 Marketing

Let us take one of the out-of-the-box marketing forms available in Dynamics 365 Marketing.

It has only an Email field marked as required and creates / updates both contacts and leads.

If we click on Check for errors we will get the below notifications.

  • To create a Contact, the Last Name (lastname) field should be included in your form and marked as required.
  • To create a Lead, the Last Name (lastname) field should be included in your form and marked as required.

Now let us host this form and try submitting it.

Click on Go Live, and create a new related marketing form page for it. Make sure you have the domain already authenticated.

Authenticate Domain

Embed Marketing Form on the external page

Open the Form page and copy the script to host the form.

On the host page, let us submit the details.

Back in our Marketing form, we can see the submission.

And also, both the lead and contact records created.

Now let us try one more submission without specifying a value for the lastname field (which it was showing in the notification, as a required field to be added on the form, for both the lead and contact table).

We can see the submissions in the Marketing Form.

And both the lead and contact records were created.

So although it shows the notification for all the mandatory fields which are not added in the form and marked as required, it still allows the record to be created.

Hope it helps..


How to – Hide, Submit and perform validation in Dynamics 365 Marketing Form

Continuing our previous post on setting hidden field’s value using JavaScript in Embedded Marketing Form,

below are a few more points that could help –

  • To hide the Marketing form on the host page – we can use afterFormRender
  • To submit the Marketing form on the host page –

  • If we are setting a non-existing value for an option set field in the formSubmit event, it will be treated as blank before submission and the blank value will be passed. However if the field is Required then validation will kick in and the form will not get submitted.

Get more details – Extend marketing form using code

Also check –


var xhttp = new XMLHttpRequest();"POST", formUrl + "/formpage/” + formId + “/correlation/” + correlationId, true); 

xhttp.setRequestHeader("Content-Type", " application/x-www-form-urlencoded"); 


Hope it helps..

%d bloggers like this: