Hello,
I am creating marketing from in dynamics marketing.
in my form I have many fields with drop down values, such as how did you heard about us?
this field has different option set in each of the countries we are working. is there a method to show only selected options for each form by mapping the value to same field in contact and lead?
Also how can I show the form in different language?
Many Thanks,
Elly
If I read this correctly, we should add the translations via JavaScript on the Form to change the labels and option set text. The whole process of Importing Translations into actual Option Set components only adds translations within the Dynamics Interface for users; it does not allow us to show those translations externally via a Marketing Form.
you are amazing Colfy, I can never thank you enough
Hi Elly,
I suggest you could do translation with javascript, thus you won't need to create duplicate form field records in crm.
Because CRM form has provided some convenient APIs for us to add our own customization for marketing form.
In your scenario, we could apply customization at "afterFormLoad" event.
I've added necessary comments in code, you could take them as reference and then change it to work for your owns.
// Do translation after marketing form is loaded MsCrmMkt.MsCrmFormLoader.on("afterFormLoad", function (event) { // Detect current user language var langName = detectLanguage(); // Only do translation if current language is not English if (langName !== "eng") { // Field name are saved in label element var labels = document.getElementsByTagName("label"); labels[0].innerText = translation[langName].firstname; labels[1].innerText = translation[langName].lastname; labels[2].innerText = translation[langName].email; labels[3].innerText = translation[langName].jobtitle; labels[4].innerText = translation[langName].shippingmethod; } }); function detectLanguage() { var userLanguage = navigator.language.slice(0, 2); /** * You can extend more translation texts, * For example, if contact speaks spanish, then userLanguage should be "es", * you can add case "es": return "Spanish"; then add new spanish translation in translation variable. * Currently it'll only translate fields for French and German contacts, if he/she is a Spanish or Italian, * he/she will still see English (default will return eng, which means not translate) **/ switch (userLanguage) { case "fr": return "French"; case "de": return "German"; default: return "eng"; } } var translation = { French: { firstname: "Prénom", lastname: "Nom", email: "Courriel", jobtitle: "Profession", shippingmethod: "Mode de livraison" }, German: { firstname: "Vorname", lastname: "Nachname", email: "E-Mail", jobtitle: "Berufsbezeichnung", shippingmethod: "Versandart" } // Extend translation here, each translation should be separated with comma, but comma is not required for final item };
You could see result if you had a same marketing form with those fields and paste code in your marketing page source code.
(Embed code after end of body tag: </body>, and surround code with script tag: <script> ..code.. </script>)
Original version:
Preview if I change browser language to German.
In addition, you can also change text in optionset to specific language:
Following code will change first option of first optionset text to specific text.
document.getElementsByTagName("select")[0.options[0.innerText= 'per Post versenden';
It only changes text from client side, but option item inside optionset will still map to corrensponding item in CRM,
so you could only keep one optionset if you would also like to show option items in different languages.
Regards,
Clofly
Hello Colfy,
Thank you for usual help,
Please let me know how I can hide the field or its options from the source code.
Thank you,
Elly
Hi Elly,
You can create multiple form field records and map all of them to a same field.
Field will display in Label value.
You can add multiple language fields on one marketing form, hide all of them by default,(might do it manually in source code because I didn't find hide option for optionset field)
and embed a javascript on the form's parent marketing page to only show specific field which could be match to user's language,
we can detect user's environment language by navigator.language property.
However, we couldn't do such translation for item in optionset, you still need to create different option set fields for different languages.
(but you could also change option item text by using javascript to get element and replace items text)
In a word, currently there was no OOB function to apply multiplt languages to marketing form.
In addition, I still not really understand "is there a method to show only selected options for each form by mapping the value to same field in contact and lead? ",
please share me more detailed explaination about the question if I hadn't understood your real requirement properly.
Regards,
Clofly
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,818 Super User 2024 Season 2
Martin Dráb 229,147 Most Valuable Professional
nmaenpaa 101,156