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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Dropdown value of a field changing wrt another dropdown value of another field

(0) ShareShare
ReportReport
Posted on by

Hi,

I have an issue in CRM 2013. I will like to add two fields under Account both of them drop down. lets assume A and B. The issue is that the values of B are dependent on A. If the user selects any value from A ,lets say A1 then say B1,B2,B3 are seen in the dropdown of B. Now the user has to select from these 3 values. If the user selects any other value from A, say A2, then B1,B4,B6 are seen in the dropdown of B. 

I dont know how to do this. Please advise

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Bas van de Sande Profile Picture
    4,383 on at

    Hi Bachchan,

    what you could do is write some javascript that you bind to the onChange event of Drop down A. In case the value changes in dropdown A, you can get the value. Using that value you could filter the values in dropdown list B  

    Are the dropdowns implemented as optionsets?  Or are the implemented as lookup lists?

    I hope this points you in the right direction

    Bas

  • Community Member Profile Picture
    on at

    Hi Bas,

    Thanks a lot for replying. The dropdowns are implemented as optionsets and not as lookup lists. I just wanted to know if that can be done with the help of Javascript. Please could you guide me further how to define values of B and where?How many?Will the visible clause be used in this scenario when writing javascript?

    Thanks in advance

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Bachchan,

    You can follow below steps to achieve same :

    1. Add all required option in both OptionSets.

    2. On Load of form remove all Option of OptionSet B with the help of Syntax :     Xrm.Page.getControl("new_optionsetB").removeOption("AAA"); etc

    3. Now write a function which will call on change of OptionSet A.

    4. On change of value in OptionSet A get the value  of selected option in A.
    var OptionSetAvalue = Xrm.Page.data.entity.attributes.get("OptioSetA").getValue();

    5. Based on the value selected in OptionSet A add required option with the help of below Syntax :

    Xrm.Page.getControl("new_optionsetB").addOption("B1"); etc

    This will help you to achieve your requirement.

    Hope this help!! Let me know if you need any assistance on code side.Thanks

    Regards,
    Kamran

     



  • Suggested answer
    Bas van de Sande Profile Picture
    4,383 on at

    Hi Bachchan,

    like Kamran suggested, you can use the Xrm.Page.getControl("").removeOption("") and the Xrm.Page.getControl("").AddOption()   methods.  

    I enclosed a stackoverflow article, that shows you how to write the code. --> hint: look at the verified answer

    stackoverflow.com/.../dynamically-change-option-set-values-in-crm

    I hope this helps

    Bas

  • Suggested answer
    Anil-CloudFronts Profile Picture
    on at

    There is a managed solution available as well published on MSDN. You can try it on a test instance first. Review here:

    msdn.microsoft.com/.../gg594433(v=crm.6).aspx

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans