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.
André Arnaud de Cal...
291,971
Super User 2025 Season 1
Martin Dráb
230,846
Most Valuable Professional
nmaenpaa
101,156