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
Hi Anthony,
We could set a default selected option manually by 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.
Please feel free to ask any question if you had any doubt about it. :)
Regards,
Clofly
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.
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
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
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
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"
Result:
Regards,
Clofly
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156