7

Setting Default Values For Unmapped Fields When Using Realtime Form Capture

 7 months ago
source link: https://meganvwalker.com/default-values-for-unmapped-fields-forrm-capture/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Setting Default Values For Unmapped Fields When Using Realtime Form Capture

2024-01-25
*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***

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.

actual-form-without-extra-fields.jpg
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.

add-your-fields-to-the-form.jpg
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.

get-updated-code.jpg
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.

added-fields-to-form-1.jpg
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.

modified-code-on-form.jpg
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!

mapped-fields-on-form-submission-1-1024x350.jpg
Click to view in detail

Check out the latest post:
Wave 1 2024 Customer Insights Journey Chat With Amey Holden

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 436 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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK