Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Modify global option set from plugin

(0) ShareShare
ReportReport
Posted on by

Hello!

I have a custom Entity that contains a text attribute and a boolean attribute. I want to have a global option set with options that corresponds to records of this Entity that have true value of boolean attribute. I've created both entity and option set from my .net application. So as I see, my next step is to define behavior in next cases:

1) Record was updated. If boolean value was changed from true to false, I need to delete option from option set. If boolean value was changed from false to true, I need to add option to option set.

2) Record was created. If boolean attribute was set to true, I need to add option to option set.

3) Record was deleted. If boolean attribute was set to true, I need to delete option from option set.

Sounds like a plugin to me. But when trying to execute InsertOptionValueRequest or DeleteOptionValueRequest from plugin, it shoots an error (You cannot start a transaction with a different isolation level than is already set on the current transactionDetail)

Is it possible to change option set from plugin? And if it is, what am I doing wrong?

*This post is locked for comments

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: Modify global option set from plugin

    Hi,

     try doing that outside of the original transaction (try pre-validate maybe.. or try an async plugin). And don't forget you'll need to publish those changes:

    msdn.microsoft.com/.../microsoft.crm.sdk.messages.publishallxmlrequest.aspx

    PS. As for the bad design.. I think it's all circumstantial:) Had to do exactly this with lookups/optionsets on two different projects.

  • Suggested answer
    prt33k Profile Picture
    prt33k 6,907 on at
    RE: Modify global option set from plugin

    " I want to have a global option set with options that corresponds to records of this Entity that have true value of boolean attribute"

    Why are you not using lookup?

    Changing OptionSet in runtime is bad design - OptionSet are suppose to be static data.

    Thanks,

    Prateek

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans