# Login with different user in Epicor Function

**URL:** <https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767>\
**Category:** Epicor ERP 10\
**Tags:** kinetic, customization, function, functions, e10, epicor\
**Created:** [January 26, 2023, 3:14pm UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767 "2023-01-26T15:14:46Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![NewUser](https://www.epiusers.help/letter_avatar_proxy/v4/letter/n/3e96dc/32.png) [@NewUser](https://www.epiusers.help/u/NewUser)\
**Post date:** [January 26, 2023, 3:14pm UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/1 "2023-01-26T15:14:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![klincecum](https://www.epiusers.help/user_avatar/www.epiusers.help/klincecum/32/100137_2.png) [@klincecum](https://www.epiusers.help/u/klincecum)\
**Post date:** [January 30, 2023, 4:44am UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/2 "2023-01-30T04:44:59Z")

</div>

_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**

---

<div class="post-metadata">

**Author:** ![NewUser](https://www.epiusers.help/letter_avatar_proxy/v4/letter/n/3e96dc/32.png) [@NewUser](https://www.epiusers.help/u/NewUser)\
**Post date:** [January 30, 2023, 12:34pm UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/3 "2023-01-30T12:34:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![klincecum](https://www.epiusers.help/user_avatar/www.epiusers.help/klincecum/32/100137_2.png) [@klincecum](https://www.epiusers.help/u/klincecum)\
**Post date:** [January 30, 2023, 1:59pm UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/4 "2023-01-30T13:59:52Z")

</div>

Show what ya got so far.

---

<div class="post-metadata">

**Author:** ![NewUser](https://www.epiusers.help/letter_avatar_proxy/v4/letter/n/3e96dc/32.png) [@NewUser](https://www.epiusers.help/u/NewUser)\
**Post date:** [January 30, 2023, 2:02pm UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/5 "2023-01-30T14:02:10Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![klincecum](https://www.epiusers.help/user_avatar/www.epiusers.help/klincecum/32/100137_2.png) [@klincecum](https://www.epiusers.help/u/klincecum)\
**Post date:** [January 30, 2023, 2:10pm UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/6 "2023-01-30T14:10:08Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![Hogardy](https://www.epiusers.help/user_avatar/www.epiusers.help/hogardy/32/18785_2.png) [@Hogardy](https://www.epiusers.help/u/Hogardy)\
**Post date:** [January 30, 2023, 3:24pm UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/7 "2023-01-30T15:24:18Z")

</div>

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

```auto
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… )

 ![image](https://www.epiusers.help/uploads/default/original/3X/1/d/1d3bb0c54814a87636e2fe24a345c796b5ddea7f.png)

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

---

<div class="post-metadata">

**Author:** ![gunny72](https://www.epiusers.help/user_avatar/www.epiusers.help/gunny72/32/87744_2.png) [@gunny72](https://www.epiusers.help/u/gunny72)\
**Post date:** [November 30, 2023, 2:21pm UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/8 "2023-11-30T14:21:47Z")

</div>

Hi Pierre,

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

Thanks

Mark

---

<div class="post-metadata">

**Author:** ![t.mattick](https://www.epiusers.help/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@t.mattick](https://www.epiusers.help/u/t.mattick)\
**Post date:** [February 19, 2024, 4:33pm UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/9 "2024-02-19T16:33:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.epiusers.help/user_avatar/www.epiusers.help/vincent/32/26893_2.png) [@Vincent](https://www.epiusers.help/u/Vincent)\
**Post date:** [May 8, 2024, 12:38am UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/10 "2024-05-08T00:38:14Z")

</div>

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);

```

---

<div class="post-metadata">

**Author:** ![gunny72](https://www.epiusers.help/user_avatar/www.epiusers.help/gunny72/32/87744_2.png) [@gunny72](https://www.epiusers.help/u/gunny72)\
**Post date:** [May 8, 2024, 11:08am UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/11 "2024-05-08T11:08:10Z")

</div>

Hi Tracy,

The old way is:

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

```

new way is:

```auto
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

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.epiusers.help/user_avatar/www.epiusers.help/vincent/32/26893_2.png) [@Vincent](https://www.epiusers.help/u/Vincent)\
**Post date:** [May 13, 2024, 10:13am UTC](https://www.epiusers.help/t/login-with-different-user-in-epicor-function/98767/12 "2024-05-13T10:13:40Z")

</div>

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

 ![image](https://www.epiusers.help/uploads/default/original/3X/0/7/07744bb380b34cc0063faa4af4b8f8c3d52f1786.png)

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
