web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Greg's Mom Profile Picture
    on at
    RE: Custom Service User Context

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

  • Verified answer
    Martin Dráb Profile Picture
    235,959 Most Valuable Professional on at
    RE: Custom Service User Context

    Your custom service could utilize runAs() 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

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 756 User Group Leader

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 514 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans