What dictates the user and session within a function, particularly one called via REST?
We have a range of functions within one library that are used for in-house EDI. This EDI creates a sales order, adds one or more lines, adds parts, runs the configurator and populates it with data if needed, runs OJW, among other things.
This has all been created in a dev environment by one user (let’s call me him “Dev”.) Solution Workbench creates a solution of these functions and exports. The solution is imported into a Test environment and eventually to our Live environ.
The EDI can run from numerous sources but is mostly triggered from Excel.
We have a dummy user set up (let’s call it “EDIUser”) and it’s EDIUser’s credentials that are used to make the REST calls in Excel that fire our functions to do all the Epicor magic.
Here’s our problem though. When the SO is created, OrderHed.EntryPerson shows Dev’s username. Further, all materials issued to the job are coming from whatever site Dev was logged into when EDIUser ran the automation.
There is one “master function” that’s called, and this coordinates which other functions need to be called to do various stages of the overall process. There’s quite a bit of functions-calling-functions happening, but all through the one library. At no point in the functions are Dev’s credentials used. The only time credentials are used are through Excel etc, and only then for EDIUser to call the master function.
I’m assuming that somewhere in this process I need to enforce a session and dictate the correct user, company, site etc. I’m just surprised to see Dev’s session being tied to this process and I’m unsure why this is the case.
I know it might be a big ask seeing I haven’t provided code, but would anyone be able to explain, on a broad sense, how Dev’s session would be triggered in this scenario?
Cheers!