Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Autofill a Field Based on Another Choice Field

Posted on by 166

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,323 Most Valuable Professional 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

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans