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 :
Microsoft Dynamics CRM (Archived)

Custom Action runs in User Context or System Context?

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have one custom action which internally updates Order Entity. Now, the problem is when user clicks on button and custom action is triggered, user gets error message saying AccessRight is missing. Now, the order entity belongs to different user and different BU. So my user needs Global read on Order so that he can successfully trigger custom action.

But giving global right is not possible as client doesn't want to do that. 

What is the solution? Custom action runs in user context even if the custom action owner is admin?

*This post is locked for comments

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

    Hello,

    You can do following:

    1. Call that action impersonating as other user - msdn.microsoft.com/.../mt607702.aspx

    2. Redesign your action and develop a plugin for that action, do your operations with Order using "System" IOrganizationService instance.

    3. Change your action to on-demand real-time workflow and call it on click of button. Configure workflow to run under user with elevated permissions.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi,

    I am assuming  you are calling custom action using JavaScript Web API request ,  set the MSCRMCallerID  with impersonated user id like below.

    req.setRequestHeader("MSCRMCallerID", "28888439-85AF-E511-80EB-3863BB35AD90");

    https://debajmecrm.com/2016/01/05/dynamics-crm-web-api-impersonate/

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans