web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Created/Modified Delegated By in Plugin

(0) ShareShare
ReportReport
Posted on by 15

Hello,

We have an entity that we don't want users to manually create or edit records on. The records are created and updated via plugin. I was under the impression that if the plugin is set to "Run In Users Context" set to "System" for example, I can create/edit these records via the plugin - the records will then have the created/modified by value set to the system user, but the delegate fields set to the users initiating the plugin. 

This doesn't seem to be the case however. Whilst the records are created and updated OK, the delegate fields are only ever blank. I've tried creating the OrganisationService with the various caller, initiating user IDs and so on. In terms of results, it's as you would expect - if the service is created using the system account, the records are created and updated OK but setting it to the initiating user throws an error that the user doesn't have privileges to perform the action. However in no scenario do these fields get populated. 

Have I misunderstood the delegate/on behalf fields? I've read that the above is what they should do, but maybe that was misinformation!

Cheers

P.s. the link below shows what I was expecting, but it's just not doing this - and if it's of any use, we are using XrmToolKit, though I don't think that would make any difference. But here is the organisation service code it uses:

this.OrganizationService = this.ServiceFactory.CreateOrganizationService(this.PluginExecutionContext.UserId);

community.dynamics.com/.../modified-by-delegate-created-by-delegate-in-d365

I have the same question (0)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
  • kubab Profile Picture
    15 on at

    Hi Abdul, thanks for that - 1st link is the link I'd already posted.. this is the functionality I am expecting you see, but it's not what I'm getting.

    My plugin executes as System, and when debugging I can see that the user is indeed System and the initiating user ID is the actual user that triggered the plugin, so these things are as expected. But creating/updating doesn't ever seem to populate the delegate fields as that article suggests it should, hence my confusion. I only ever see System in the created by/modified by fields. I am expecting that, but I am also expecting to see the initiating user to be populated in the delegated fields. I can't set these fields in the plugin.

    Cheers

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi kubab,

    You should need to raise a ticket to support from Power Platform Admin Centre.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 71 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 66 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 46 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans