In Dynamics 365, when testing plugins, you can change which user the plugin runs under. Due to this, open the step in the Plugin Registration Tool. We have a plugin that runs on the creation of an account, that creates a new Task. We will select this to run under the context of a user, Alan Steiner by setting Run in User’s Context:

Our user Alan Steiner does not have privileges to create a new task in the system:

So what happens when we try to create a new task (as either Alan or any other user)? Create a new account:

Our plugin code will run. Now go to System Jobs. You will see the plugin failed to execute:

Open the job, and you will see the details show the user does not have access to the prvCreateActivity privilege:

Set the plugin back to the Calling User to run as normal:

Note you can also impersonate a user within your plugin code by using


From the documentation: “When called in a plug-in, a null value indicates the SYSTEM user and a Guid.Empty value indicates the same user as IPluginExecutionContextUserId. Any other value indicates a specific system user.”

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.