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 228,493 Most Valuable Professional 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.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans