Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

Auto Populate option set field on one entity with values from text field from another entity

Posted on by
Hi, 
I am looking for possible solutions to Auto Polulate option set field on one entity with values from text field from another entity. So for example I have a field /State/ in Accounts where the data type is Text. Next, I have  again the /State/ field in Opportunity where data type is /Option set/. I am trying to auto populate my state field in Opportunity form from values of State field (Text) existing in Accounts entity. If in Accounts table that field is blank then I want user to select one value from the option set.
My challenge is the data type of State field is different in both entities. 
Any workaround to above issue?
 
  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Auto Populate option set field on one entity with values from text field from another entity
    Hi Partner,
    Yes, you can use Javascript code to achieve it.
    If the value in the text field is not an option that already exists in the option set field, you need to create the new option firstly:
    --formContext.getControl(arg).addOption(option, index);
    If the option already exists, you can set the value directly:
    https://carldesouza.com/get-and-set-field-values-using-formcontext-and-javascript-with-dynamics-365/
    I hope you can mark my answer verified if it is helpful! If you have any questions, please feel free to contact me.
    Regards,
    Leah
  • Martin Dráb Profile Picture
    Martin Dráb 225,864 Super User on at
    Auto Populate option set field on one entity with values from text field from another entity
    D365 consists of many applications, such as Finance and Operations, Sales or Business Central. You're asking in D365 general forum, therefore it's not clear which product you have in mind. Adding this information is crucial, because each of the products works in a very different way, use a different programming language and so on. Then moderators will be able to move thread to the right forum.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans