I'm writing MS Dynamics CRM 2011 plugin who is performing manipulations with data on behalf of the system user: changing statuses in required manner, filling administrative information, etc.
I'm using following code to get OrganizationService
running on behalf of the SYSTEM
:
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = factory.CreateOrganizationService(null);
And on development environment everything is running smoothly, but when I deploying assembly on staging environment, for some reason this code is not working anymore. System have chosen one user, let's call him John Doe
and runs actions on behalf of him.
I cannot get why this might happen: both environment are more or less the same, the only difference is the IFD used on staging.
Is it possible to disable user SYSTEM
somewhere in the MS CRM? If yes, where I can find this setting? What else I should check to resolve the issue?
The way in which you create an IOrganizationService object is correct
The parameter 'null' on the CreateOrganizationService function indicates that a service will be created for the SYSTEM account. Retrieves and created will be done by the SYSTEM account. No further impersonation is needed.
For more information see MSDN.
Is the plugin is registered in the same way in both environments? In the PluginRegistrationTool is it possible to select an different user under which the plugin is running. What do you selected there?
You cannot disable the system user, the user is default disabled. System processes will use the account.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With