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

Dependent optionsets json

(0) ShareShare
ReportReport
Posted on by 90

Hi everyone,

I want to create a json data for the dependent optionsets. 

The data is as follows-

3 fields - A, B, C

Field A options- 1, 2, 3

Field B options- 4, 5

Field C options- 6, 7

Now, the optionsets are dependent in the following manner:

If Field A=1, Field B= 4, Field C=6

If Field A=2, Field B=4, Field C=7

As you can see, field A can be 1 or 2, but field B is same for both these values. So, while creating json, I am struggling because the json doesn't allow duplicate. 

How shall I proceed?

Thanks

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Dependent optionsets json

    Hello,

    Just curious - how do you plan to use that JSon?

  • D_M Profile Picture
    90 on at
    RE: Dependent optionsets json

    Hi,

    I will be calling this json config file in my js web resource on load and on change.

    The JSON I have configured is something like this-

    "grand": "A",

    "Parent": "B,

    "Child": "C",

    "Options":{

    "1" : {

     "4" : [

         "6"

        ]

     },

    "1" : {

     "5" : [

         "7"

       ]

     }

    "2" : {

     "4" : [

         "7"

       ]

     }

    }

    Now, in the JS I would save the list of child values as - Options[A's value][B's value]

    For example- if value of A set is "1" , B is "4", then the list for child values should have "6" and so the child field C should be filtered to show only "6". But the Json is not valid as there is duplicate keys.

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Dependent optionsets json

    I would highly recommend restructuring your JSON to parent/child relationship. Something like here - github.com/.../Dependent-Optionset-Control

    Also you can use something that already exists on the market without reinventing the wheel - crmoptionsets.azurewebsites.net/

  • D_M Profile Picture
    90 on at
    RE: Dependent optionsets json

    Only Parent child relationship is not possible in my case as the parent is not unique. As shared by me in my json example, parent value "4" is shared by both Grand values "1" and "2". So onchange of parent, I have to check the value of grand, based on that I have to filter the child.

  • D_M Profile Picture
    90 on at
    RE: Dependent optionsets json

    Can I use a combination?

    For example; in the above json that I structured, if I combine the first two values-

    Options:{

    "1-4":[

     "6"

    ]

    }

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Dependent optionsets json

    I'm sorry but I'm still not sure what's wrong and what task you're trying to resolve. I believe you're overthinking something. Can you please provide the description of task with type/sub-type/sub-sub-type scenario.

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 178

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 142 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans