How can I call an Epicor Function (Custom Library) from a Data Directive?

I know how to call an Epicor Function from a Customization (REST) or Method Directive (It’s in the widgets) but I can’t seem to find how I’m supposed to call my functions in a Data Directive?

Anyone has an idea how to do so?

It has to be from code. I’m pretty sure there’s a post here about it. I haven’t done it myself, though.

If anyone has it it would be appreciated. Searched on this forum but haven’t found anything. I’m trying to do this in an In Transaction Data Directive

I haven’t tried in the Data Directive. This is the code to call a function within the code.
this.InvokeFunction(“GLAcctLib”, “ValidateGLAccount”, Tuple.Create(TranGLCRow.COACode, TranGLCRow.GLAccount));

2 Likes

Do you have any more documentation on this? Where are you putting this? Inside a data directive?

Thank you so much. Got it working in a Data Directive custom code:

var result = (Tuple<Decimal, Decimal, String>)this.InvokeFunction("LibraryName", "FunctionName", Tuple.Create(Parameter1, Parameter2, Parameter3, Parameter4, Parameter5));
decimal return1 = result.Item1;
decimal return2 = result.Item2;
string return3= result.Item3;

So, I had to put the type of my the variables that I returned between the Tuple<>

4 Likes

This is wonderful. This makes Data Directives about 750 times more useful to low-coders like me.

And thank you for providing the template in understandable pseudo-variables. I used this to call my own function with success.

For me it was “no new orders for this customer because they are in a particular group.” (The group is what we will use to flag customers as inactive.)

When all you want is to block a record or transaction based on a related table, this is SO much easier than trying to figure out every possible way that a new order can be created and make Method Directives for all of them.

2 Likes

For sure man! I remember that headache way back when I had even less of an idea of what I was doing in Epicor. The concept was something like your case… Eventually I had to say, I don’t know how we can do this because there were so many ways to do something and every method had a different set of business objects it was working through, screens, etc…

1 Like