web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

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

(0) ShareShare
ReportReport
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?
 
I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    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.
  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    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

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 47 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
Pallavi Phade Profile Picture

Pallavi Phade 32

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans