Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

hi all,

     I am following the steps in this below link to create two dependent option  sets.

msdn.microsoft.com/.../gg594433.aspx

when I select an option in the parent option set field .there are no options in the child dependent field to select. please help me

thanks

*This post is locked for comments

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

    Hi Murali,

    In addition if you are not comfortable with dependent optionset , you can use simple Javascript below -need to fire onchagne of state field.

                function OnChangeState() {
                    var stateValue =Xrm.Page.getControl("new_state").getAttribute().getValue(); // Get State value
                    var optionSet = Xrm.Page.ui.controls.get("new_citiies"); // Get All City 
                    var optionSetValues = optionSet.getAttribute().getOptions();
                    optionSet.clearOptions();
                    if(stateValue == "100000000" )
                    {
                        optionSetValues.forEach(function (element) {
                            if (element.value == "100000000" || element.value == "100000001")
                                optionSet.addOption(element);  // Add City based on State
                        });
                    }
                    else if(stateValue == "100000001" )
                    {
                        optionSetValues.forEach(function (element) {
                            if (element.value == "100000002" || element.value == "100000003" || element.value == "100000004"|| element.value == "100000005")
                                optionSet.addOption(element); // Add City based on State
    
                        });
                    }
                }



  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

    Hi Ahmed,

    I removed those commas and it works now. Thanks a lot. your help meant a lot :)

    Thank you

  • Verified answer
    naZir Profile Picture
    naZir 850 on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

    Remove those commas (100,000,001->100000001) for all

  • naZir Profile Picture
    naZir 850 on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

    6862.2.PNG

    Onchange of state you should call this function and pass these 2 arguments

    6862.2.PNG

  • naZir Profile Picture
    naZir 850 on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

    Please try this

    Check the Schehma name

    [

    {

        "parent": "new_state",

        "child": "new_citiies",

        "options": {

            "100000000": [

                "100000000",

                "100000001"

            ],

            "100000001": [

                "100000002",

                "100000003",

                "100000004",

                "100000005"

            ]

        }

    }

    ]

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

          hi Ahmed                                                         

    Screenshot-_2800_163_2900_.png

    please check this screenshot. this is what happening when I select option in the field.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

    I am using only two dependent option sets.

    pls check the below code

    [

     {

         "parent": "new_state",

         "child": "new_citiies",

         "options": {

             "100,000,000": [

                 "100,000,000",

                 "100,000,001"

             ],

             "100,000,001": [

                 "100,000,002",

                 "100,000,003",

                 "100,000,004",

                 "100,000,005"

             ]

         }

     }

    ]

     

    thank you

  • naZir Profile Picture
    naZir 850 on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

    [

     {

         "parent": "new_state",

         "child": "new_places",

         "options": {

             "100000000": [

                 "100000000",

                 "100000001",

                 "100000002"

             ],

             "100000001": [

                 "100000006",

                 "100000007",

                 "100000008"

             ],

             "100000002": [

                 "100000003",

                 "100000004",

                 "100000005"

             ]

         }

     }

    ]

  • naZir Profile Picture
    naZir 850 on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

    Post your code here .. so that we can see

    It should be like this

    [

     {

         "parent": "sample_category",

         "child": "sample_subcategory",

         "options": {

             "727000000": [

                 "727000000",

                 "727000001",

                 "727000002"

             ],

             "727000001": [

                 "727000003",

                 "727000004",

                 "727000005",

                 "727000006",

                 "727000007"

             ]

         }

     },

     {

         "parent": "sample_subcategory",

         "child": "sample_type",

         "options": {

             "727000000": [

                 "727000000",

                 "727000002",

                 "727000003"

             ],

             "727000001": [

                 "727000004",

                 "727000005",

                 "727000006"

             ],

             "727000002": [

                 "727000007",

                 "727000008",

                 "727000009",

                 "727000010"

             ],

             "727000003": [

                 "727000011",

                 "727000012",

                 "727000013",

                 "727000014"

             ],

             "727000004": [

                 "727000015",

                 "727000016",

                 "727000017",

                 "727000018"

             ],

             "727000005": [

                 "727000019",

                 "727000020",

                 "727000021",

                 "727000022"

             ],

             "727000006": [

                 "727000023",

                 "727000024",

                 "727000025",

                 "727000026"

             ],

             "727000007": [

                 "727000027",

                 "727000028",

                 "727000029"

             ]

         }

     }

    ]

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: dependent option sets. I am not able to fetch options on the child option set field on selecting parent option set field.

    Hi Md Ahmed,

    I have given the arguments. on empty parent field ,child dependent field is locked. and the lock gets released once I choose options in parent field.but I cant find any options on child field and it is empty.

    thank you

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans