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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Custom Service User Context

(0) ShareShare
ReportReport
Posted on by

Hi there, 

When developing and calling a custom service in D365 F&O, is it possible to provide a user context so that audit fields like created by and modified by reflect another D365 F&O user rather than the user who is making the service call?  I have an external web application that runs as a service account.  The external web application calls other 3rd party APIs to get data that needs to be integrated into D365 F&O.  The external web application gets the data from 3rd party APIs and then calls a D365 custom service that I've created to synchronize the data from the 3rd party into D365.  This is functioning well but the audit fields on my D365 tables reflect the service account that is calling the custom service.  My users would like to see the records reflect as having been created by and modified by the user who created the record in the 3rd party system.  

Is there a pattern or any guidance that allows the D365 service method to run in the context of another user so that it can appear that another user called the service method instead of the service account that my web application is running as?  Any suggestions are greatly appreciated!  

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    238,129 Most Valuable Professional on at

    Your custom service could utilize runAs() method.

  • Greg's Mom Profile Picture
    on at

    Thank you very much, I was unaware of this method.

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

News and Announcements

Season of Giving Solutions is Here!

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 679 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 410 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 292 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans