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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Unable to access Field Security enabled field using Impersonation in Web

(0) ShareShare
ReportReport
Posted on by 60

I am using Dynamics 365 v9 on-premise.

The Impersonation successfully worked in Plugin and workflow. In Plugin, I created the OrganizationService by var service = serviceFactory.CreateOrganizationService(null); And In workflow i did impersonation by setting OrganizationServiceProxy CallerId.

But, I also have external web application where i do Active Directory authentication, create CRM service and do rest of the data retrievals from the database.

Here after web authentication, I am creating CRM service, i am updating the CallerId of the proxy and creating Retrieve request for the secure fields data. Although I am updating the CallerId, its still not getting the data. I checked all the privileges for the user.  

So, i tried the WEB API method. below code: systemuserguid is the systemuserid of SYSTEM user. This is my request and i get null for secure fields. User has no read privelages to the secure field. So, i am trying to impersonate and was able to excute plugin and workflow but not external web application authentication and then create crm service and update the CallerId. And try to get the secure field data.

Key is the secure field i am trying to access.

var options = "?$select=key,name";
var endpoint = Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.0/accounts(guid)";
var uri = endpoint + options;
var request = new XMLHttpRequest();
request.open("GET", encodeURI(uri), false);
request.setRequestHeader("MSCRMCallerID", "systemuserguid");
request.setRequestHeader("OData-MaxVersion", "4.0");
request.setRequestHeader("OData-Version", "4.0");
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader("Content-Type", "application/json; charset=utf-8");

Please anyone can help me why MSCRMCallerID not working in this case.

Thank you.

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    I don't think you will be able to do that - that is a security threat - just imagine that anyone who knows about this MSCRMCallerID will be able to do whatever they want in the system without sysadmin permission.

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    One workaround is to create Action in Dynamics and use plugin code to register on this action. From plugin code set output parameter with the value retrieved from secure field. Add impersonation code in yoru plugin.

    Then call this custom action from external application to fetch secure field value.

    Please mark my answer verified if i were helpful

  • sam12 Profile Picture
    60 on at

    I am trying to impersonate using webAPI. here is the article.

    docs.microsoft.com/.../impersonate-another-user-web-api

    In this, they are creating records but in my example i am trying retrieve a record .

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans