Saturday, June 15, 2024
- Advertisement -
More

    Latest Posts

    Setting Default Values For Unmapped Fields When Using Realtime Form Capture

    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.

    Setting Default Values For Unmapped Fields When Using Realtime Form Capture
    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

    Latest Posts

    - Advertisement -

    Don't Miss

    Stay in touch

    To be updated with all the latest news, offers and special announcements.