I wrote about using the new preview (as of time of writing this) feature on Realtime Marketing forms with form capture. This gives you the ability to map submissions from 3rd party forms but still create the new/updated Contact or Lead record in D365. In that post, I wrote about the process of mapping the fields on your other form to fields on your form in the marketing app. That all works great, but what about setting defaults on the record in Dynamics 365 when there is no corresponding field on your external form? This post shows you how to do that.

To get started, review the post Using Form Capture With Realtime Marketing Form Submissions. Then come back here. This is my form built using another 3rd party solution. In order to map the field submissions, I need to have a corresponding field to create or update a Lead record in D365.

Click to view in detail

However, I also want to set all of these as defaults. Add the fields to your form in D365. No need to hide them as no one will see this form, they will be filling in the one above instead. I’ve picked 4 different type fields so you can see how to handle the mapping of text, two option, choice and lookup fields. Save and make your form live.

Click to view in detail

Just like in the other blog, you will get your code by clicking on the Form capture option and then copying the code you need.

Click to view in detail

Assuming you read the other post, you will know you need to adjust the code to fill in details for the mapping. When you were mapping the fields from the 3rd party form, you would add the field name where it shows ***Please fill***. However, in the case of the 4 fields above, there is no field on our 3rd party form, so we need to do something a little different.

Click to view in detail

If you review the script above, you can see the four fields all expect to have something added to the FormFieldName. However, as there is no field on the 3rd party form, we start by removing that line for each of those unmapped fields. What we need to leave is the DataverseFieldName and then set the DataverseFieldValue. Let’s look at each of the four fields types:

Dataverse Field NameTypeDataverse Field Value
Purchase NeedTwo Options0 for No, 1 for Yes
Lead SourceChoiceValue from the list provided
IndustrySingle Line TextText you with to use
Source CampaignLookupGUID from the record you wish to use

Here you can see how I updated the script to set the values needed. For the lookup, just make sure you replace the actual ID of a record in place of the ***Please fill** text that was added to the original script you retrieved from your marketing form.

Click to view in detail

Now once the form is submitted, those four additional fields will have a default value set for each one. Perfect! Hope this helps!

Click to view in detail

Check out the latest post:
Internal Notification Emails For Event Forms In Realtime Marketing

D365 Marketing Weekly
Have you seen the D365 Marketing Weekly newsletter yet?
A weekly issue covering features, functionality and news on the topic of Marketing, specifically covering Dynamics 365 Marketing and other interesting tools and tips for anyone interested in the subject.
Subscribe Here
This is just 1 of 440 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.

2 thoughts on “Setting Default Values For Unmapped Fields When Using Realtime Form Capture

  1. Hi Megan,
    do you have any advice to set a default value for multi-select optionsets?
    For me it seems there is a different behavior to a normal optionset..

    1. Hi Valentin, you would have to make adjustments in the HTML to do this. If your multi-select is going to be hidden, add it to your form first, then set it as hidden. Then open the HTML, search the the name of the values you want to set and then just add the word checked to the end of the input row. For example, this would be one of the values:

      Just simply adjust it like this:

      That’s it! That option will then be checked and submitted as a default. Hope that helps!

Leave a Reply

Your email address will not be published. Required fields are marked *