top of page

[TIPS] Impersonate Dynamics 365 user

  • Writer: Amraoui Hamza
    Amraoui Hamza
  • Dec 13, 2021
  • 2 min read

There are times when your code will need to perform operations on behalf of another user. If the system account running your code has the necessary privileges, you can perform operations on behalf of other users.


In Dynamics 365 online, when we need to peform the tests for the security model or reproduce the same scenario for a bug alerted by a user, It could be a nightmare since we need to login and logout many times and use many browser.

Then I found this chrome Extensions named "ModHeader", it's helps you to impersionate another user without login, This article will share how to deal with impersonation using Chrome extension.


How To Get Started?

The main point is that your running account must have "prvActOnBehalfOfAnotherUser" privilege. And in the header of request need to impersonate must have one of these param:

  • MSCRMCallerID: system user id

As I mention in the previous section, you need to ensure that your account has "prvActOnBehalfOfAnotherUser" privilege.

To enable this privilege, you can open your security role and navigate to tab "Business Management", find "Act on Behalf of Another User" in the last section check enable it

INSTALL ModHEADER

You can find ModHeader extension here or you can open Chrome/Firefox web store and search for ModHeader.


Use modheader

Open the mod header extention and add the "MSCRMCallerID" as key and the user you want to impersonate as Value.


Refresh the page, and try to do some Dynamics CRM Operation :

  • Create new records.

  • update an existing record.

  • ….

You will find the the CreatedOn or The ModifiedOn is the user you want to impersionate and not the real connected user.


STOP IMPERSONATING

When you want to finish troubleshooting the security model. You have many ways to do it:

  • Disable ModHeader extension

  • Pause ModHeader extension

Please note that this methode is available only on dynamics online.


You can find here the full documentaion.


I Hope It helps.

 
 
 

Comments


JOIN OUR MAILING-LIST

Keep in touch

Thank you !

bottom of page