Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

How do I populate lead source from a hidden field on Marketing Form?

Posted on by 455

Hi Everyone, 

We have an option set field called Lead Source on our Lead entity and we'd like to populate it from a Marketing Form.  We don't want Lead Source visible on the form.  

It doesn't seem like you can hide an option set field.  Does anyone have any advice on how to solve this problem?

Thanks,

Tony 

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: How do I populate lead source from a hidden field on Marketing Form?

    Hi Anthony,

    We could set a default selected option manually by javascript.

    https://stackoverflow.com/questions/78932/how-do-i-programmatically-set-the-value-of-a-select-box-element-using-javascript

    In posted link, the demo select element(optionset) has a pre-defined id, 

    however, we couldn't add id attrribute to elements of Marketing Form,

    an alternative solution is that by getting optionset element(select element) object directly with getElementsByTagName() Method:

    var selectElement = document.getElementsByTagName("select")[0];

    (expression above is equal to "document.getElementById("preference")", if there is only one select element on HTML page and its id attribute is "preference".)

    Then we can get value attribute of a specific option by inspector.

    Finally run our populating function at "afterFormLoad" event of form.

    https://docs.microsoft.com/en-us/dynamics365/marketing/developer/marketing-form-client-side-extensibility 

    Please feel free to ask any question if you had any doubt about it. :)

    Regards,

    Clofly

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How do I populate lead source from a hidden field on Marketing Form?

    Hey Anthony, it seems really hard to add an attachment to posts in the forum here. Which is why I added is a dropbox link. Nonetheless, I edited the post and added another link that should work. I also sent a private message with the file. Hope this helps. Feel free to ask questions.

  • AnthonyUliano Profile Picture
    AnthonyUliano 455 on at
    RE: How do I populate lead source from a hidden field on Marketing Form?

    Hi Niels,  Thanks for your reply.  I tried to click on the link you provided, but it's not working.  Can you reshare?

    Thanks,

    Tony

  • AnthonyUliano Profile Picture
    AnthonyUliano 455 on at
    RE: How do I populate lead source from a hidden field on Marketing Form?

    Thanks so much for the quick reply Clofly!  You always provide such expert answers!  

    If we wanted to set the value of the option set in the background (ex. depending on the a variable like page title), how would we do it?  The visible fields are available for user input, but how do we populate the value of hidden fields like this?

    Thanks again,

    Tony

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How do I populate lead source from a hidden field on Marketing Form?

    Clofly's answer below works fine. However, if you want more extensive lead source tracking you might also want to look at using UTM for source. (wrote a little manual on that: community.dynamics.com/.../how-to-guide-on-implementing-utm-tagging-in-dynamics-365-marketing)

    You have a complete view of your source this way and the effectiveness:

    source: Linkedin

    medium: social

    Campaign: name of your specific campaign/post

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: How do I populate lead source from a hidden field on Marketing Form?

    Hi Anthony,

    We can hide an option set field manually by adding hidden attribute control to its content block.(I formatted form source code in VS editor for better look.)

    hidden="hidden"

    8422.JPG

    Result:

    pastedimage1591237673554v1.png

    Regards,

    Clofly

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans