Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Load Opionset with Existing Lookup

Posted on by 395

Hi,

Can any one help in loading the option set with existing lookup values? I have 6 option sets on different forms. Currently these option sets are loaded with Global option set values which we keep in synch with Competitor lookup. Currently whenever there is a new competitor value we manually update the global option set which we want to avoid. We want to have this change reflected in Global option set whenever a new competitor is added.

I don't think writing some code in form load may be a good idea, every time I need to compare with Competitor lookup and not sure that will work correctly. Any thoughts how to synch the option sets with Competitor lookup values?

*This post is locked for comments

  • Suggested answer
    ganeshm Profile Picture
    ganeshm on at
    RE: Load Opionset with Existing Lookup

    I tired to add optionset value using script,u can change then to dynamically by retrieving the value from competitor lookup and adding them to optionset during the on-change event. 

    var optionsetField = Xrm.Page.getAttribute( "address1_addresstypecode" );

    var Options = optionsetField.getOptions();

    var advanceOption = new Option();

    advanceOption.value = 2;

    advanceOption.text = "Advance";

    Xrm.Page.getControl("address1_addresstypecode").addOption(advanceOption, 7);

    hope this helps you.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Load Opionset with Existing Lookup

    Refer this as to how to add a option to global optionset and retrieve the values from global optionset.

    msdn.microsoft.com/.../gg509023.aspx

    msdn.microsoft.com/.../gg509070.aspx

  • Suggested answer
    Micchael Profile Picture
    Micchael 390 on at
    RE: Load Opionset with Existing Lookup

    Hi Srini,

    I think most common and reliable way for such automation is a piece of server code .

    I would add a plugin on post create of Competitor entity to update the global option set.

    To favor of Mark's point: Predictable scenario is overloaded option set.

    Someday it can over  20 Competitors or 200 and it's going to be a very bad user experience.

  • Suggested answer
    TheMarkChristie Profile Picture
    TheMarkChristie 10,328 on at
    RE: Load Opionset with Existing Lookup

    Hi

    In this situation rather than write code for it I would add the lookup to the forms and replace the option sets

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

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans