Epicor Function for API - First Attempt!

I am attempting to create a Function to be used as an API. This is my very first attempt and am failing miserably. I think it is because I am lazy and don’t want to do to much work that might end up being unnecessary.

With that said, my question is do I have to trace a transaction in the system and then replicate ALL of the method calls?

Generally, yes.

** I say generally because sometimes you can get away with not calling some. Couldn’t tell you which–you’ll have to discover that on your own. If you’re just starting out, you should just replicate them all.

Here’s an example I’m working on with Inventory Transfer. The red ones I’m skipping.

1 Like

+1 on what @hmwillett is saying.

Generally, the ones I don’t use are the calls to fill drop-down boxes or other UI-related purposes. An API won’t need those.


@jkane I might suggest don’t start with inventory transfer…

I made an EFx for that a few months ago. It’s a bear. I went totally rogue on that since the trace seems to leave out a lot of details.

Maybe start with something simpler…

But huzzah and you can do it!


You’re not wrong, lol.

Freaking deferred updates…

1 Like

No, wait, I take that back - it was issue material.

Sorry, I did both around the same time. Inventory transfer might be fine.

1 Like

Oh, yeah that.

So yes @hmwillett if you do finish this, I would like to learn from it. I think we are still getting bit from that here.

1 Like

I don’t know if Quote is simpler, but that’s what I’m starting.

Is it one big chain of Widgets or should I create a bunch of Functions in a single Library for each method?

So it would be one Function for creating the header, getting customer info, etc, and update. Then a second function for creating a line, etc.

Isn’t there a restriction where you can’t call a function from another function in the same library?

1 Like

Just create one function to do the thing. All of the code or BO widgets can be in the single function. Then call the function as needed to do the thing.


Not anymore.
You can also get around that using reflection if on a version that does.


And you can copy widgets from one function to another if needed. So if you wanted to test pieces and then assemble them.


As always, you people are the best! I’m diving in :man_swimming:t2:


Start simple,

Test with Postman/ API help or similar,

Then build it up,

Save yourself some pain from having to publish/promote the function and use the staging address…Not at my PC to give you an exact example url.

There are some examples for calling the rest API in the online help, including an example web app.





1 Like