web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

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

(0) ShareShare
ReportReport
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 

I have the same question (0)
  • Verified answer
    cloflyMao Profile Picture
    25,210 on at

    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

  • Community Member Profile Picture
    on at

    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

  • AnthonyUliano Profile Picture
    455 on at

    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

  • AnthonyUliano Profile Picture
    455 on at

    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

  • Community Member Profile Picture
    on at

    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.

  • cloflyMao Profile Picture
    25,210 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans