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 CRM (Archived)

Dynamics CRM Plug-In Development by using Mutex

(0) ShareShare
ReportReport
Posted on by

Dear Experts,

I am trying to develop autonumber plugin using Mutex in an online CRM instance but while running the plugin getting the below error:

Unhandled exception:
Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: An error occured in Autonumber pluginSystem.MethodAccessException: Attempt by security transparent method 'AutoNumber.Class1.Execute(System.IServiceProvider)' to access security critical method 'System.Threading.Mutex..ctor(Boolean, System.String)' failed.

Assembly 'AutoNumber, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ec05ba87d2fba43a' is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself. In order to access security critical code, this assembly must be fully trusted.

Plugin in registered in sandbox mode.

Thanks in Advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Prashant_ Profile Picture
    1,040 on at

    Hi,

    If you are using latest version then you can create  auto number field.You  have to execute simple code in console to generate such field because UI not available for it .Following link will help  you

    docs.microsoft.com/.../create-auto-number-attributes&nbsp

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Sandboxing doesn't allow some assemblies/namespaces to be used. It seems that Mutex is in the list of not-allowed classes. You will have to use different approach for it.

    You will have to use different approach to implement locking - www.akaes.com/.../how-to-implement-robust-auto-numbering-using-transactions-in-microsoft-dynamics-crm

  • Winston Profile Picture
    on at

    Hi Prashant,

    Thank you for the reply.

    In our scenario, we have 5 different sequential numbers for single entity based on the business unit type. for ex., BU1001, BU2001, BU3001, BU4001, BU5001 are 5 different sequential numbers based on the business unit user belongs to. does the auto-number attributes support these scenario.

    Regards

    Winston

  • Prashant_ Profile Picture
    1,040 on at

    Hi Winston,

    Unfortunately your requirement cannot be achieve using auto number attribute.You have to work on your plugin now and solve issue. Andrew Butenko gave you solution may be that will help you.

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans