After our consultants wrote a quick guide on how to call business objects in Epicor® using ABL/4GL code, we’ve received several inquires regarding the code for performing this same action in Epicor® version 10, which uses C# language. So, we’ve put together this quick how-to for you!
Below is the source code that you can insert to automate Epicor® business processes by calling a business object using C# code.
Here is the source.
Method directive on ABCCode.Update
add reference to UD01 assembly:
Ice.Contracts.BO.UD01
no “using” statements required
/*Delcare a UD01DataSet variable */
var UD01DataSet = new Ice.Tablesets.UD01Tableset();
/* Declare variable hUD01 of type Ice.Contracts.UD01SvcContract and set its value to null */
Ice.Contracts.UD01SvcContract hUD01 = null;
/* Select the first ttABCCode if it exists and store it in a new variable ttAbccode_xRow */
var ttAbccode_xRow = (from ttAbccode_Row in ttABCCode
select ttAbccode_Row).FirstOrDefault();
/*Set the value of hUD01 */
hUD01 = Ice.Assemblies.ServiceRenderer.GetService(Db);
/* If hUD01 is not null: */
if (hUD01 != null)
{
/* call the hUD01 object’s GetaNewUD01 method and put the result into the UD01DataSet variable */
hUD01.GetaNewUD01(ref UD01DataSet);
/* Get the first row from the UD01DataSet, if it exists */
var ttUD01_xRow = (from ttUD01_Row in UD01DataSet.UD01
where ttUD01_Row.RowMod == “A”
select ttUD01_Row).FirstOrDefault();
if (ttUD01_xRow != null)
{
/* Assign values in the new UD01 record. */
ttUD01_xRow.Company = Session.CompanyID;
ttUD01_xRow.Key1 = “AbcCode”; /*Table that was affected*/
ttUD01_xRow.Key2 = “CountFreq”; /*Field that was affected*/
ttUD01_xRow.Key3 = DateTime.Now.ToString(“HH:MM:SS”); /*Time*/
ttUD01_xRow.Key4 = System.Guid.NewGuid().ToString(); /*Unique Identifier*/
ttUD01_xRow.Date01 = DateTime.Now; /*Date*/
ttUD01_xRow.Number01 = ttAbccode_xRow.CountFreq; /* Value from AbcCode */
ttUD01_xRow.ShortChar01 = Session.UserID; /*User id*/
/*Commit record*/
hUD01.Update(ref UD01DataSet);
}
}
Have more questions about Epicor® ERP, or another solution like Infor CloudSuite consulting? Datix has 25 years’ of experience with ERP solutions, making us a premier source for successful ERP projects and tips. Give us your questions by contacting Datix today!
With over two decades in the industry, Datix is the ERP consultant of choice for manufacturers and distributors. We believe in “being the best with the best” and look for partners who match our commitment to solving real issues and doing what it takes. Our in-depth analysis of our clients and their business needs allows us to maximize their software investments to the fullest.
Salesforce integration consulting is about more than just finding a partner with experience in integrations.…
Platform: HubSpot Where It Shines: Email marketing - easy to use email lists, automation, and…
Don’t be left behind by neglecting these 2024 manufacturing trends.
With a comprehensive ERP like CloudSuite Industrial (CSI) from Infor, there are countless possibilities for…
An Infor ERP solution isn’t just a temporary fix to today’s issues, it’s an investment…
An Infor ERP can dramatically improve your operations, but with an ERP integration, you can…