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!
Thank you very much, I was unaware of this method.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Sohaib Cheema 756 User Group Leader
André Arnaud de Cal... 629 Super User 2025 Season 2
Martin Dráb 514 Most Valuable Professional