Login with different user in Epicor Function

Good day,

I am trying to create a record for Epicor Function Maintenance but I need to change user when doing this process.
I have multiple companies set up in Epicor. From a function I am trying to create the same record in all companies, but business rule, the user does not have access to all companies. To create it I must use a different user per company.

I am trying something like this:

string config = “c:\Epicor\Config\Production.config”
Ice.Core.Session sessionEpi = new Ice.Core.Session(user, pass, “Production”, Ice.Core.Session.LicenseType.Default, config);

Function throws error on “Ice.Core.Session” but that dll doesn’t exist in functions.
Does anyone know how I can login a different user from a function?

There is probably a slick way to do it, but one way is to call into one function,
and use rest with different credentials to call your final function.

You might want to drop some security checks on that first function, depending.

User A – Calls Function FuncOne

FuncOne, using different credentials, calls FuncTwo via the Rest API

1 Like

.Ok, but, I need an example of how to create the login because the way I’m doing it doesn’t work correctly.

Show what ya got so far.

I am trying using that but I am exploring a new way to login by “API-REST”

I’ll see if I can work you up a simple example, since I can’t find exactly
what I’m looking for in the search.

In the meantime, here is a thread that should get you started using RestSharp:
(With or without using his cool little function.)

https://www.epiusers.help/t/custom-library-for-sending-rest-calls-out-of-epicor/83881

You should be able to use that, and the swagger pages to figure it out.

Actually, that is how I connect with my .Net DLL’s

var session = new Ice.Core.Session("id", "pw", Ice.Core.Session.LicenseType.Default, @"C:\EpicorClient\ErpPilot\config\ErpPilot.sysconfig");

But with the new version Kinetic, my VS gave me warnings that it is obsolete. (but still works though… )

What is GUID license type ?
and I did not find Erp.License anywhere ?

Can someone enlight me on how to change the session string ?
thanks.
Pierre

Hi Pierre,

I think external Dll’s are being phased out - you are better off moving to REST to connect.

Thanks

Mark

1 Like

Hi
Did you manage to get this working, I am now having the same issue
Would appreciate any help you can give

Hi I phase the same thing on this as simple session connect which is working find previously in E10 and now come to E11 (Kinetic) with the latest dll is not working anymore, I get the null reference object error.

    private static Session epiSession = new Session(
                            UserID,
                            Password, "",
                            Session.LicenseType.DataCollection,
                            ConfigPath, false,
                            CompanyID,
                            PlantID);

Hi Tracy,

The old way is:

var session = new Ice.Core.Session("id", "pw", Ice.Core.Session.LicenseType.Default, @"C:\EpicorClient\ErpPilot\config\ErpPilot.sysconfig");

new way is:

var epiSession = new Ice.Core.Session("UserName", "", "", Ice.License.LicensableUserCounts.DefaultUser, @"C:\Epicor\cag-vm-erpapp01\ERP11.2.400.6Client\Client\config\EpicorERP.sysconfig", False, "CABP", "MfgSys")

Hope this helps!

Thanks

Mark

Hi Thanks,
but i still facing the same error on detect null reference even has point correctly.

just I’m confuse the yellow highlight was input on the user ID or name?
The license load seems like different from origin and is there any reference need to load for this ? i have a error not found on this config.
the App url can be empty am I correct?

Please help and we have some E10 application need to load and run for kinetic