Kinetic, Functions and Application Studio

I’ve been poking around the Application studio in an effort to gauge pain points on a full upgrade to the Kinetic interface. When trying a function out in Application studio I got stuck because I couldn’t pull the results into the fields on the form.

On a whim, I put a message box on the function widget for the “OnError” and it was triggered. The API call resulted in the following message in the debugger:

Looking at the call itself, it returned the expected data from the API. I’m just unsure why it is hitting the OnError path instead of the OnSuccess path. If I do the row-update logic on the Error side, it fills in the form just like I wanted.

Which brings up a second question. If I have the results coming back from the function, is there any way to assign the opposite value of a Boolean result to a view? Something like:

"!{actionResult.hasErrors}"

EDIT: Turns out, that’s exactly what I need to put in…

2 Likes

The issue I have is the erp-function call is not being shown as a Success. It’s following the Fail route. That’s what I cannot figure out. I’ve got the return (on the OnError path) data going to their fields.

image

Any clues in Dev Tools either in the console with CTRL+ALT+8 active or on the network tab for the Efx call?

1 Like

This is the only thing I’ve got that stands out. I didn’t define any response parameters defined for the function because I’m not tying to any dataset/dataview and wasn’t sure what to fill in for that.
image

What’s the JSON response look like for your Efx call?
You may need to put a value in the “Parse from Response Path”.

I suspect that because it defaults to returnObj, it’s trying to find that since you didn’t enter anything different and throwing null because your JSON probably is something else.

It’s fairly simple:

{
    "success": false,
    "message": "No Record Found"
}

I’ve tried some paths, but no change…

You could just negate doing the success/error branch (remove them) then drag row-update onto the editor and link them. You should then be able to use actionResult.success or actionResult.message.

1 Like

That works, but since I’m trying to learn I’d like to figure out what this error is so I can develop correctly. I’ll keep looking into it. Thanks!

1 Like

@hmwillett … since this was my own function, I had to conform to the way Epicor expects the results to come (based on looking at their API):

{
  "returnObj": {
    "results": [
      {
        "success": false,
        "message": "No record found"
      }
    ]
  }
}

Now it’s following the right branch.

2 Likes

Good to know! :beers:

Still interesting, though, as I’ve used my own functions and the success branch with no issues and I did not format it like you did. :thinking:

1 Like

I’m testing on 2022.1.8 … maybe a change from 2021 to 2022?

So now, the fun is gaining access to those results :angry:

Hmm, I don’t think so, because I do all of my testing in 2022; I’ll check, though!

The easiest way would be to set the results to a view.
Set the response params to the following:
Parameter Name: results
View Name: whatever your view is called
Parse from Response Path: returnObj

1 Like

That’s a cool way to do it, the view. Less work I suppose?

I don’t know if it’s less work, but it does give you some debugging options as well as future use of the returned fields. If you do something else the uses actionResults, the previous information will be lost. If you save it to a view, it’s yours to use until you call that function or modify the view on your own.

1 Like

I looked through help and didn’t find it. Is there a way to manipulate the data that’s returned?

Manipulate in what way?

Like update a field in another view based on the results. Or update a field in the current view… again, just trying to learn. I have no business need.

If you’re returning the function data into a view, you can then do a row-update to do both of the scenarios you mentioned.
Let’s say you created a view called EFX with two fields: success and message.
Using row-update to update another view (let’s say TransView), you would set the epBinding to TransView.YourField and the value to “{EFX.message}”.
Using row-update to update the same view is pretty much the same. Set the epBinding to EFX.message and the value to “Your updated message”.

1 Like

Sometimes the answer is so obvious you don’t even try to look at it.

Sigh.

Thanks!

3 Likes