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

Community site session details

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

Marketing form translation

(0) ShareShare
ReportReport
Posted on by 205

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

I have the same question (0)
  • Steve Coleman Profile Picture
    30 on at
    RE: Marketing form translation

    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.

  • Elly-Farokhi Profile Picture
    205 on at
    RE: Marketing form translation

    you are amazing Colfy, I can never thank you enough

  • Verified answer
    cloflyMao Profile Picture
    25,210 on at
    RE: Marketing form translation

    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:

    pastedimage1579663060634v1.png

    Preview if I change browser language to German.

    pastedimage1579662871707v1.png

    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';

    pastedimage1579664262300v2.png

    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

  • Elly-Farokhi Profile Picture
    205 on at
    RE: Marketing form translation

    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

  • Verified answer
    cloflyMao Profile Picture
    25,210 on at
    RE: Marketing form translation

    Hi Elly,

    You can create multiple form field records and map all of them to a same field.

    Field will display in Label value.

    pastedimage1579514076184v1.png

    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.

    pastedimage1579514274471v2.png

    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 

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 182

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 125 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans