Calling an Epicor Function Library method from C# Form Customization

We have created an Epicor Function library with a few methods in it, and we’re customizing our MES screen and wanting to call these methods. It seems like this should be something super simple to do with built-in Epicor services or functions or something, but everything online seems to point to we’ll have to fire up the REST api to attempt this? Are we missing an easy way to call these methods from an Epicor Form Customization, or is REST the only way?

1 Like

I think REST is the only, and easiest, way. REST is automatically available in K2022, so nothing to fire up. It is now the native way to talk to Kinetic.

@tkoch pointed out examples in the documentation:

Epicor ICE 3.2 Customization User Guide

1 Like

You can use Function Runner.

Function Runner 1
Function Runner 2

As your agent, I am embarrassed that I didn’t think of that.

Despicable Me Reaction GIF

2 Likes

It’s ok, the less people that use it, the less I have to re-explain my poor explanations.

1 Like

In classic you can use a ubaq to call the function using generic calling dynamic query code, just another way that might be useful.

2 Likes

You can use RestClient in classic customization:

image

using Ice.Lib.RestClient;

var restClient = new RestClientBuilder().UseSession(this.oTrans.CoreSession).Build();
var functionParamContent = new RestContent(new { param1 = "X", param2 = "Y" });
System.Net.Http.HttpResponseMessage funcResponse = restClient.Function.Post("LibraryName", "FunctionName", functionParamContent, published: true);
2 Likes