The problem nobody budgets for
Every Epicor team knows the routine. A new hire starts, and someone has to create the Epicor user, grant the right companies, attach the right security groups, link the user to an employee record, and set up inspector or buyer details where the job needs them. In a multi-company installation that is the same set of clicks repeated in every company, across several screens, from memory.
The cost is not the minutes. It is the drift: a role granted in one company and forgotten in another, a user linked to the wrong employee, and an audit question nobody can answer quickly: who can actually open this menu?
- 1 dialogfor companies, roles and the employee link
- 1 Updatecarries all three changes to Epicor
- 5 reportsaccess, menu tree, explorer, buyers, cache
- 0 secretsin source control or logs
What the application does
- Users: create Epicor users and maintain their details from one screen.
- Company and role access: grant or remove companies and security groups for a user across every company in one save.
- Employee link: propose and set the employee record per company, with the admin able to override each one.
- Inspectors and buyers: set up inspector records and review buyer setup per company.
- Access reporting: answer which companies, roles and menus each user can reach, exported to CSV for audits.
The architecture
The design rule is simple: read often and cheaply, write rarely and carefully. Reads come from Epicor Business Activity Queries and are served from a shared in-memory cache. Writes go straight to the Epicor REST services, one user at a time, and every write is checked.
A cache that fails gracefully
BAQ calls are the slowest part of the app, and several pages need the same data. A shared cache loads each dataset once, even when several requests ask for it at the same moment (single flight). If Epicor is briefly unavailable, the app keeps serving the last good copy instead of an error page. A cache browser shows what is held and how old it is, and lets an admin refresh it on demand.
Security: an app that can create users is a privileged system
Any tool that creates Epicor users and grants company access holds the keys to the ERP. It deserves the same care as the Epicor security manager role itself. This is how the build handles it, and what we recommend for production.
| Risk | In this build | Recommended for production |
|---|---|---|
| Leaked Epicor credentials | Credentials live in .NET user secrets or environment variables, are blank in configuration files and are never written to logs | Move them to a vault such as Azure Key Vault; rotate them whenever an administrator leaves |
| Over-privileged API access | One dedicated Epicor service account, used only by this app | Restrict the REST API key with an Epicor access scope limited to the services the app calls |
| Unauthorized use of the app | The app has its own admin logins, stored in its own SQL database | Keep the admin list short, require HTTPS, and host the app on the internal network or behind VPN or single sign-on, never on the open internet |
| Changes no one can trace | Structured Serilog logging of each write and its verification result | Retain logs centrally and review them in the regular access audit |
| Testing in the wrong environment | A clear Pilot or Production banner on every page | Prove every request shape in Pilot after each Epicor upgrade before using Production |
The access workflow
This is the part that took the most care. Granting company access in Epicor is not one call. It is a short conversation with the UserFileSvc business object, and each step has to leave the dataset in a shape the next step accepts.
Verify, do not assume
The most useful rule in the build: a successful HTTP response is not a successful change. Epicor can accept a request and still not persist a row. After every save the app reads the user back and compares the company list, the security group list and the company rows with what was requested. If anything is missing, the admin sees exactly what, not a green message.
RowMod = "A"), not an update ("U"). Sending an update for a row that does not exist produces the “record not found by its SysRowID” error. One rule in the merge step removed a whole class of failures.Matching users to employees automatically
Each company holds its own employee records. When companies are selected, the app proposes a default employee for each one, trying these rules in order and stopping at the first match:
- The employee ID or login ID equals the user ID.
- First and last name match.
- The same employee ID already exists in another company.
- The email address matches.
- No match: the field stays empty and the admin chooses. Nothing is linked silently.
Answering “who can open this menu?”
Epicor menu security is decided by several conditions at once, and menus and security groups are defined per company. The app rebuilds that evaluation from BAQ data, one index per company. A user can open a menu item only when every check below passes:
- The menu item is enabled.
- It is not restricted to security managers only.
- Neither the user nor any of their groups is on the item's deny list.
- The item's entry list is empty, or it contains the user or one of their groups.
- Every parent menu above it passes the same checks.
The menu and role explorer lists one row per menu and role pair. Choose a role and you see every user who holds it. Audit questions that used to take an afternoon become a search box.
What the reports cover
| Report | Question it answers |
|---|---|
| User access | Which companies and roles does this person have? |
| Menu access tree | What can this user open, shown as the real menu hierarchy? |
| Menu and role explorer | Which roles reach this menu, and who holds them? |
| Buyers | Who is set up as a buyer, in each company? |
| Cache browser | What data is the app holding, and how fresh is it? |
Every report exports to CSV, and the filters suggest menus, roles and users as you type, so admins do not need to remember exact codes.
Lessons from the build
- Treat the error text as the specification. Epicor’s messages named the exact parameter they expected; reading them closely shaped the final request bodies more than the documentation did.
- Verify after every write. A read-back turns a silent partial failure into a clear message.
- Parse the data you really have. Entry lists were comma separated while user group lists used a different separator. One wrong assumption made a report look empty.
- Assume duplicates. Security groups repeat once per company; remove duplicates before building any dictionary.
- Keep secrets out of the repository. Credentials belong in user secrets, environment variables or a vault, never in configuration files or logs.
- Make the environment obvious. A Pilot or Production banner prevents the most expensive kind of mistake.
The takeaway
Good internal tools are rarely about new technology. They remove a repeated, risky task, show the truth about the system, and say plainly when something did not work. A shared cache, a careful write path and a read-back check were enough to turn user onboarding from a ritual into a single, reviewable action. The same pattern, cached BAQ reads and verified writes through Epicor business objects, carries over to other administrative work in Kinetic.