App Studio - Adding ReqHead Dataview and Rest-erp to Purchase Order

I’m struggling to get a DataView set up in App Studio. I’ve gone through a lot of iterations but I must be missing a step.

End Goal: see Requisition information on the PO Release.

I was able to easily add the ReqNum and ReqLine, as these are native to the PORel table. However, I also wanted to include the RequistorID… which is stored on the ReqHead table.

The DataView is set up…

Based on example exercises, I attempted to set up the Event to AfterGetByID:
image

This is one area I wasn’t sure about… Method Params > Field Value… am I correct that this is the field I want to use to link the Rest service with? If that’s the case, I believe I want to base this off the PORel.ReqNum.
image

I did see examples where this should be in {}… and other examples where it was not. I tried both and got the same error.

Response Params: Again, not 100% sure here. I believe the Parameter Name is the system table I want to pull from… and the View Name is the DataView I want to populate with that information. Is that correct?

Within the Response Params: there is also “Dataset” set-up. I’m not sure what to put here (if anything)… I’ve been playing around with various things to no avail.
image

Long story short… when I preview the layer… I get an error:
image

Any thoughts on where I went wrong on my set-up?

Looks fine.
The only thing I would point out is doing anything with the Response Parameter > Dataset breaks it entirely. Even just looking at it and not entering data.
Delete the widget and recreate it with the way you have it set up, but do nooooot touch the dataset.

Some debugging:
Open Dev Tools from the Web UI and activate tracing with CTRL+ALT+8 and see what kind of error it throws in the console when your event runs.

Then check the network tab and look at the GetByID call and see if there are any issues with it. Is it red? Do you see information in the Preview tab?

If yes, go back to the console and press CTRL+ALT+V… do you see data in the ReqHeadAdd view?

What is your Requestor ID field bound to?

Thanks Hanna! Not gonna lie… I was hoping you might chime in!

I deleted and rebuilt the entire event… stayed out of the Dataset area!

I still get an error when I preview (opens PO Entry Landing Page)… at this point, I haven’t selected a PO, so there is no PORel.ReqNum to use to fetch the ReqHead data against… which could be my issue?

Debugging Error:
erp-rest-service [post] 500 - OK Http failure response for https://…/api/v1/Erp.BO.ReqSvc/GetByID

Network Tab: yes, GetByID is red.
Preview: Sorry! Something went wrong. Please contact your system administrator. Correlation Id: f9b350c0-0902-4c27-8660-17ce58857c5a

However… If I select a PO and then navigate to the PO Entry… the RequestorID field IS POPULATED.

So, the rest call is working… but it is causing an error on the landing page, I’m assuming, because it is trying to call using PORel.ReqNum data which hasn’t been selected yet.

Should I repoint this “event” against a different target instead of AfterGetByID?

Yeah, you may not have the info you need at that time.

For my test, I threw it on the control’s OnCreate event and it worked fine.
A lot of what Kinetic is–is finding the correct event to key off of.



image

So, are you just using the TransView instead of adding the ReqHead as a DataView?

Doesn’t really matter. You can bind it to your ReqHeadAdd.RequestorID view/col.

Well… I’ve repointed to the OnCreate event… but I’m still getting the error when the Landing Page first loads.

I tried deleting my ReqHeadAdd dataview and re-adding… but that didn’t fix it, either.

What are the settings in your row update?

Is the old event still there, by chance?

Yes, I had deleted it… but the error persisted.

I scrapped my whole layer… started over… now working fine. No idea where it was getting hung up. But all seems to be working now!

Thank you so much for all your help!

Dean Norris Reaction GIF by CBS

Hi @hmwillett Hannah, can I pester you for a quick second?

Apologies it has been awhile on this topic so you’d have to refresh yourself… but perhaps not since it should hopefully be an easy question/fix.

Review: I’m adding Requisition info on my PORel form. Added a dataview and rest-erp call to returnObj based on ReqNum.

All worked… but (silly me) I was only testing with examples of PO’s generated from requisitions.

If our purchasing staff opens a PO Release form, which DOESN’T have a linked requisition, they receive a “Record not found” error. I think they’ve gotten used to just closing this error… but I’m sure it is a nuisance and I fell like I left them with an unfinished product. It should (hopefully) be an easy fix.

Anyway, I’m sure this is a beginner question… but how do I prevent the error, if the Rest-erp call bounces back without a result?

Add a condition after your REST call that checks the dataview for rows:
%DataViewName.hasRow%
If true, do the thing.
If not, don’t do anything or log it.

1 Like