Epicor Functions Test

I’ve built the example from the help but no luck in getting it to work beyond I get back the name of the library and its description. Using Postman to call it. I can change the description on the library and that updates. I also built a function that returns a hard coded string and does nothing else same result.

Any suggestions on where to look? Thanks much in advance.

https://centralusdtpilot09.epicorsaas.com/xxxPilot/api/v2/efx/staging/xxx/Testing/OrderSum

[
{
“LibraryId”: “Testing”,
“Description”: “Hello there”
}
]

Can you post your function? What are your output parms and where are you setting them?

Thanks for the quick response.

The OrderSum function is from the Epicor help on functions,Widget Function . It takes a customer number, sums the total value of orders and returns it via a decimal return. If it finds nothing it should return zero. Response is populated using a set argument widget from the workflow designer.

The other function is a custom code function has a response parameter of myName, String.

The only code in the function is
this.myName = “Good-Bye”; // tried it with and without “this.”

So you’re using a Code Widget to set the myName? Does it work with the Set Argument widget?

The OrderSum does it that way (and doesn’t work either), for a custom code you don’t have access to using the set argument widget, all code is free form.

I run into a different issue. I created an echo library that sets the outparm = inparm; The second parm returns a value from the call context and the third is a fixed string. So I’m able to set those in code.

So I don’t have your error as I can set it to a string but it appears that I don’t have access to the input parameter. ???

**** Moved this to a new thread ***

Wait. I’m a dumbass. I was passing in the inparm on the URL instead of the body. It works now:

@Jkinneman, try one more thing. Instead of free-text, right-mouse click and insert the parameter that way. The first time I just typed it, it didn’t take it. After I inserted it via the context menu, then it recognized it. And it did so every time after that too.

Mark W.

Yesterday I did my first official “complicated” function with 4 inputs (two dates, one integer, one string) and one output (a date). This function calculates something similar to Microsoft Excel’s Weekday function where you give it a date and days, and a holiday schedule, and it calculates a new date.
I called the function from a BPM, pushing the Starting date, “Not before” date, Days, and referenced an Epicor Holiday calendar. Amazingly, it worked, and returned the date I was expecting. Now, I need to extend and make more functions for the library that are date related.

I think I found my issue. In Postman I was sending it with a “GET” when I should have been sending it with a “POST”. Now I get a permission error so at least I am making progress. This is a cloud install.

1 Like

Been there…

I’ve suggested to the Epicor Functions/BPM team that this is one cool place to be able to call a Function from a BAQ. Being able to add work days to a BAQ would be extremely powerful for EDD displays.

5 Likes