Skip to main content

Notifications

Dynamics 365 Community / Forums / Sales forum / Autofill a Field Based...
Sales forum
Suggested answer

Autofill a Field Based on Another Choice Field

Posted on by 146

Hello, I have an entity called Prospect. In that entity, I have a field/column called Country (dropdown Choice field synced with Global Choice named 'Country'). Once the user selects the country from the list, there is another field called Affiliations which should show which countries are affiliated with that selected country.

I have the list of countries affiliated with each other based on The 27 Sub-Regions of the World - OBJECTIVE LISTS

For example, if I select United States in 'Country' field, 'Affiliations' field should show Canada, Australia, New Zealand, Great Britain, and Ireland.

1) Should 'Affiliations' field be synced with the same Global Choice 'Country'?

2) How can I accomplish this using JS? I know I can hard code it as below but it's obviously not optimal: 

var countriesAssocitions = {
//Afghanistan
  4: [139, 198],
//Albania
  8:[158],
//Algeria
  12: [17],
//American Samoa
  16: [155, 47],
//Andorra
  20: [32],
//Angola
  24: [140],
//Antigua and Barbuda
  28: [47],

  31: [21]
 //etc
 }

where every value on the left represents the index of a country from the global choice 'Country' and the indices on the right are those of the affiliated countries. \

Is this the right way to go about it or is there a better way such as creating an array for every group of affiliated countries (there are 27 groups)?

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,319 Moderator on at
    RE: Autofill a Field Based on Another Choice Field

    Hello,

    It looks like that that's the perfect usecase for the dependent optionset - www.crmanswers.net/.../dependent-option-set-manager.html

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,186 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,996 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans