Calling a Function from Custom code

woah, there’s a epicor built in swagger page ?!?

I’m very familiar with swagger and postman,
if there is a built in epicor swagger page please tell me where

Thanks

You poor soul.

https://yourserverinstance/apps/resthelp/#/home
https://yourserverinstance/api/help/v1/index.html
https://yourserverinstance/api/help/v2/index.html

You can also install the MS Remote Debugger on the server and debug your functions that way. I have done it with BPMs and now am with Functions. It is a nice way to debug your code.

Ok, swagger gave me:
500 Internal server error. Server is unable to process the request.

I’m still confused about why it works in my method directive (call function)
but not my custom code…call function

they both are running server side correct ?

What do you mean your “Custom code”?

Is this a screen customization? Those are run client side.

If you are cloud, Ice.Diagnostics.Log.WriteEntry(“”); can be viewed with my dashboard:

Server Event Log Dashboard

Use “Epicor App Server” as the Event Log name on the side.

1 Like

He’s calling a function from the client through the rest helper.

Yes, I have a screen customization calling a function (code function not widget function) via rest api.

I also have a method directive calling the same function.

the first thing the function does is pop open a message (which works when calling from the bpm)
but calling the function from the screen custom code does not

this (and the swagger response) makes me believe it’s not even getting to my function in the screen customization case

so, 1. if you can do it on the server side, do it there. Future you will thank you.

  1. I believe the rest client on the classic screens are broken, and I don’t know if they’ve ever been fixed.

On Swagger your message Info will show up as a header under CallContext. If you are getting 500 on Swagger there’s ssomething else wrong with your function.

1 Like

It’s not going to. It’s a miracle it gets passed back from the bpm that triggers it.

“on the side” ? I don’t see it, sorry

That link was in case you are cloud and wanted to use my dashboard to see the event logs.
No way you read that thread yet :rofl:

Are you saying that the invoke is not even working, it’s not even getting to my function ?
(that’s my belief)

If you are getting an error in swagger there is something wrong with your function or your input to your function. Messages come back in the response headers (as shown below)

1 Like

Is your function promoted (published)? Did you add your company in the Security Tab?

I thought I had seen that before, thanks for the reminder.

yes, promoted and company in security tab

btw, someone said, classic rest api is broken

I have two other functions in the same library that are being called from this same screen customization code that work

It is for certain authentication methods. However if the others work then its fine. Get it working in swagger / postman first.

If you are getting 500 error (what is the message)
What does your function look like (what is it doing)
Go to the Server and look at the Event Viewer on that 500 error it should give you more details.

Then double check the variables you are passing are not null, named correctly, are in the proper type etc.

I’d also comment out everything and just pass back a debug message first.

1 Like