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,...
Suggested answer

Add Javascript on Preference center for multi-lingual field text change based on OptionSet

(0) ShareShare
ReportReport
Posted on by 63
HI Team,
 
I want to understand how can we add javascript on Preference Center in Customer Insight Journey for OnChanges event of Optionset field to update the other fields label in form 
for example, I have default English value in OptionSet and all my fields are also in english language. I want to update it in Arabic then onchange of the optionset, it should update all the text label of form and show that form in Arabic.
 
Please provide for any supporting blogs or Microsoft link as well. Thanks
I have the same question (0)
  • Suggested answer
    Holly Huffman Profile Picture
    6,522 Super User 2025 Season 2 on at
    Add Javascript on Preference center for multi-lingual field text change based on OptionSet
    Good morning, afternoon, or evening—depending on where you are in the world!
    Hope you're doing well.

    Currently, Customer Insights - Journeys does not natively support JavaScript injection or advanced scripting directly within the Preference Center UI. This limits the ability to use onChange events on OptionSet fields to dynamically update label text across the form.
     
    What’s Possible (and Not):
    • JavaScript customization is not officially supported in the hosted Preference Center pages.
    • The Preference Center is rendered as a managed Power Pages site, and while you can customize layout and styling using CSS, dynamic behavior like label switching based on OptionSet values is not exposed through the standard configuration [1] [2].
     
    Workarounds:
    1. Use Power Pages with Custom JavaScript:
      • If you're using a custom Power Pages site to host your Preference Center, you can inject JavaScript to listen for OptionSet changes and update labels accordingly.
      • Example:
         document.getElementById("languageOptionSet").addEventListener("change", function(e) {
             const selectedLang = e.target.value;
             if (selectedLang === "Arabic") {
                 document.getElementById("label1").innerText = "الاسم";
                 document.getElementById("label2").innerText = "البريد الإلكتروني";
             } else {
                 document.getElementById("label1").innerText = "Name";
                 document.getElementById("label2").innerText = "Email";
             }
         });
      • This assumes you have control over the HTML IDs and structure, which is only possible in a custom-hosted version.
    2. Use Multiple Forms:
      • Create separate forms for each language and use the OptionSet to redirect users to the appropriate version. This is more static but avoids unsupported scripting.
    3. Submit Feedback to Microsoft:
      • This is a common multilingual use case. If you're working within the out-of-the-box Preference Center, consider submitting feedback or a feature request via the Dynamics Ideas portal.
    Note: I collaborated with AI to help craft this response and ensure it’s as accurate and helpful as possible.
    Hope this helps!

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 170

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 116 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans