External custom DLL to implement special functionality

Hi,

I have an external DLL written for Epicor 9, which I am attempting to update for migration to Epicor 10.

In Epicor 9, I was able to access the User Defined Table Data (specifically UD03), which is stuffed with configuration settings and other data that is critical to the functionality of the DLL.

My issue in Epicor 10 (version 10.2.300.12) is that I am unable to access the data in the UD03 table and pull it into the DLL. In testing, I have a “helper” app (executable) I am writing that simulates a session in Epicor.

My attempts so far to access the data have failed, hinged around what I believe to be the issue of the adapter object requiring oTrans not oTrans.Session. I pulled the code out of the DLL and tried to run it locally in the executable helper app, but unfortunately, I have been unable to to simulate oTrans.

I am now just trying to retrieve any data from the table (I have confirmed that it does contain data, and all records have Key1 = 1), but have been unable to do so.

The error message I get from my code is: Unable to cast object of type ‘Ice.Core.Session’ to type ‘Ice.Lib.Framework.ILaunch’.

Please see the code snippet below:

public partial class Form1 : Form
{
Ice.Core.Session epiSession;

public Form1()
{
		try
		{
				if (epiSession == null)
				{
						epiSession = new Session("username", "password", Session.LicenseType.GlobalUser, @"PATH TO CONFIG FILE HERE");
				}
		}
		catch (Exception ex)
		{
				Console.WriteLine(ex.Message);
		}
		UD03Adapter UD03Search;

		try
		{
				UD03Search = new UD03Adapter(epiSession);
				UD03Search.BOConnect(); // Try to connect to the business object
				string whereClause = "Key1 = 1";
				SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
				opts.NamedSearch.WhereClauses.Add("UD03", whereClause);
				bool morePages = false;
				UD03DataSet UD03DS = (UD03DataSet)UD03Search.GetRows(opts, out morePages);
		}
		catch (Exception ex)
		{
				Console.WriteLine(ex.Message);
		}
}

}


Any assistance is greatly appreciated

You need to wrap your epiSession into an iLauncher then pass that to UD03Adapter.

var oTrans = new ILauncher(epiSession);

Example:

var oTrans = new ILauncher(epiSession);
UD03Search = new UD03Adapter(oTrans); // Magic
UD03Search.BOConnect(); 
1 Like

Omg you saved my life. Thank you! That worked!

1 Like

You can use @josecgomez github repository as a reference.

Also if you haven’t checked this out yet, you should #opensource

Will do. Thank you again!

Now, to REALLY save your life have @josecgomez, @Chris_Conn, or @jgiese.wci show you how to use REST endpoints so you’re not burning up full desktop licenses with a stand-alone program - especially if this is a read-only situation. :wink:

2 Likes

https://YourServer/YourInstance/api/help/odata/Ice.BO.UD03Svc/index

or more specifically to the question:
https://YourServer/YourInstance/api/v1/Ice.BO.UD03Svc/UD03s?%24filter=Key1%20eq%20’1’

1 Like

Yup yup yup
Custom DLL’s is NEVER the solution (says the guy who just wrote a bunch of them for this extension thing… but I had no choice)
I hate it , Hate it , hate it. Please do yourself and everyone else a favor and don’t write custom DLL’s they are version dependent and a damn nightmare to maintain.

REST REST REST REST

2 Likes

BTW, @hkeric.wci has forgotten more Epicor programming than I’ll ever know. He can do REST, DLLs, whatever…

1 Like

Go ahead and take our Job Security away, go ahead. :cowboy_hat_face:

I agree if you can, avoid it… It’s a matter of time before you will be required to sign your dll’s with Epicor.snk which you won’t have unless you own the SDK that may land you in the 20-50K cost.

We actually have 1 External BPM, someone wrote before my time - they bundled it with the Epicor.snk for 10.1… in 10.2 - its a no go :slight_smile:

1 Like

@Mark_Wonsil one rule to follow… Upgrade from E9 to E10 AS-IS, so you can compare apples to shiny apples.

Then later do REST :blush:

Respectfully disagree, why implement twice, if you are going through the upgrade process. It is a good time to evaluate, re-think, re-do, do it better, faster cheaper :wink:
It’ll take him X hours to uplift it and X±Delta to just re-do it “RIGHT” in REST…
So why waste X and then X+DELTA?

2 Likes

Did I tag you or Mark Wonsil? :stuck_out_tongue: I guess it depends hehe, I find AS-IS easier obviously once we are done with the Uplift Stage, then before Go-Live we add additional tweaks, enhancements.

1 Like

LoL when’s the last time you saw me not interject when no one called me LoL…

1 Like

Thanks everyone. I appreciate all the suggestions. Unfortunately, the easiest / fastest way to upgrade is for me to convert the DLL, so for now I don’t have an option to use REST. Perhaps in the future. :slight_smile: