Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Filter field values depending on other field

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

  • pepper1000 Profile Picture
    pepper1000 on at
    RE: Filter field values depending on other field

    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]);
    		}
    	}
    }
    


  • Suggested answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: Filter field values depending on other field

    Hi,

    I think you can achieve this using option set filtering.

    Here are more details on option set filtering.

    community.dynamics.com/.../251071

    community.dynamics.com/.../283159

    www.magnetismsolutions.com/.../Filter_Option_sets_by_another_field_in_Dynamic_CRM_2011.aspx

    www.powerobjects.com/.../filtered-lookups-vs-dependent-option-sets

    community.dynamics.com/.../238567

    Hope this will help...

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans