Advertisements

{Dynamics CRM Plugins Impersonation} Identify which for your plugins are running under impersonation

Recently we upgraded one customer from their CRM 2011 to CRM 2013 environment. During the process of upgrade and new features implementation, we were developing in separate environment while the existing customer system was still going on.

Just before going live with the upgrade, our client informed us that there had been considerable number of changes in plugin configuration specially in relation to the user’s context under which the plugin was running and their internal team lost the track of all those changes. To tackle this first we did a thorough merging of the plugin code and then deployed the solution in CRM 2013 Production environment. Then we ran the below SQL in the existing production environment and the new production environment.

Select DISTINCT pa.Name [Assembly],
pt.Name [Event Handler],
mpt.Name [Step],
CASE mpt.Stage
WHEN 10 THEN ‘PRE-VALIDATE’
WHEN 20 THEN ‘PRE-OPERATION’
WHEN 40 THEN ‘POST-OPERATION’
END AS Stage,
sm.Name [Message],
ev.LogicalName [Entity],
su.FullName [Impersonating User]
FROM SDKMessageProcessingStep mpt INNER JOIN SDKMessage sm ON mpt.SdkMessageID = sm.SDKMessageId
INNER JOIN SDKMessageFilter mf ON mf.SDKMessageFilterId = mpt.SDKMessageFilterId
INNER JOIN EntityView ev ON ev.ObjectTypeCode = mf.PrimaryObjectTypeCode
INNER JOIN PluginTypeBase pt ON mpt.PluginTypeId = pt.PluginTypeId
INNER JOIN PluginAssemblyBase pa ON pt.PluginAssemblyId = pa.PluginAssemblyId
INNER JOIN Systemuser su ON su.SystemUserId = mpt.ImpersonatingUserId
WHERE mpt.ImpersonatingUserId is NOT NULL
AND mpt.Stage <> 30 AND mpt.IsCustomizable = 1

After running the above code, it became very easy for us to go to the appropriate steps and change it by comparing the results from both the environments.

Hope this helps!

Advertisements

About Debajit
I am a Dynamics CRM Most Valuable Professional (MVP) with 10 years of experience in Microsoft .NET Technologies and 7 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: