REST calls, Sessions, and BPMs

Hey,

I’m just starting to play around with a Python script to call an EFx and the ramifications.

For example, I call a function to create a new record, say an order line. There’s a BPM on the order line that enforces the population of the product code, where it throws an exception if the field is empty. A common BPM.

With the script there’s no user to note the exception and correct it, so it just fails.

My thinking is to set some quasi-global callContextBpmData field to tell the BPM that the process is from a REST call and to process the exception differently somehow. Something like CheckBox10 is always set to true if called from outside.

So, the questions:

Anyone done something like this?

Can I create a session in the Python script to pass to the function? (think I’ll go to the swagger page to check if there’s an ICE object that returns a session)

What about fields marked “required” that aren’t caught in the BPM?

What about screen customizations?

Other advice?

Thanks,

Joe

All my EFX functions return at the very least an ErrorMessage string. In the function, just put everything in a try…catch, and if there is an exception, put it into the ErrorMessage output parameter. This way the exception makes its way to the REST client correctly.

Should mention that this only really works for code functions, or code widgets, I don’t use widgets at all personally…

1 Like

Thanks, Hugo.

I’d like a way to pass in that context variable to have some control in the BPMs, whether I’m going through a function or to one of the REST services directly.

Digging around. . .

Joe

Just keep an eye on the size. In Kinetic, you are limited because this goes through the http header.

Cool. Just one boolean. :slight_smile:

Thanks,

Joe