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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Filter field values depending on other field

(0) ShareShare
ReportReport
Posted on by

Situation:

In CRM we wish to register the languages the contact person speaks, as well as the preferred language.
The preferred language must be one of the languages attached to the contact.
So contact A speaks German, English and French, then the preferred language must be one of these three (and cannot be Spanish).

What is the best practice to deal with this?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at
  • pepper1000 Profile Picture
    on at

    I think I found a way by using JavaScript. The script is not complete yet, but it's a start.

    // new_languages 			= multi select optionset
    // new_preferredlanguage	= (single select) optionset
    var languages;
    var preferredLanguageControl;
    var prefLangOptions;
    var languagesLength;
    //
    onLoad = function () {
    	languages = Xrm.Page.getAttribute("new_languages").getValue();
    	multiLanguageChanged();
    }
    
    
    multiLanguageChanged = function () {
    	preferredLanguageControl = Xrm.Page.ui.controls.get("new_preferredlanguage");
        prefLangOptions = preferredLanguageControl.getAttribute().getOptions();
    	languages = Xrm.Page.getAttribute("new_languages").getValue();
    	//
    	if (languages != null) {
    		languagesLength = languages.length;
    		preferredLanguageControl.clearOptions();
    		for (var i = 0; i < languagesLength; i++) {
    			preferredLanguageControl.addOption(prefLangOptions[i]);
    		}
    	}
    }
    


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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans