API with preset: Table not found

I am attempting to update a table which is not part of the app from which the API is being invoked. I am attempting to do so through the use of an API Webhook ‘Preset’. The table is found and can be selected to populate the ‘Table Name’ field of the preset as seen in the attached image. However, Appsheet complains that the table cannot be found?..

Maybe I am going about FILTERing the row to be updated incorrectly. Appsheet does not complain about columns not being found, some of which are only in the same table it complains that it cannot be found.

What is the proper way to select a specific row in the foreign table that is to be updated by the API webhook?

Any help would be appreciated.

@Steve @Phil @Aleksi

0 5 314
5 REPLIES 5

Hi Michael,

I think you are reporting that the reference to table “Punch_List” in the FILTER expression of the Body template is saying that table “Punch_List” cannot be found.

If so, that is occurring because the FILTER expression in the Body template is being evaluated in the application that is calling the webhook. The calling application does not contain table “Punch_List” so it cannot read that table to evaluate your FILTER expression.

If you need to run a FILTER or SELECT expression against the “Punch_List” table in the app that calls the webhook, you need to include table “Punch_List” in the calling app.

@Phil

The object is to update a row in the Punch_List table which is in the ‘other’ app. If I include the ‘Punch_List’ in the app calling the Webhook, I wouldn’t likely need the hook. I do not need the entire table Punch_List in the app calling the Webhook.

Occasionally, the app containing the Punch_List table (Lets call it app ‘A’) will run a Webhook that adds a row to a ‘Jobs’ table in the other app (App B). The Webhook does not add all fields of the Punch_List table to the row being created in App B. The addition of this row via Webhook from A to B creates a ‘job’ in App B.

When the status of the job in App B is changed, I need to update the corresponding row in App A. How can this be accomplished? I assumed I could do so through the Webhook…

Hi Michael,

App A (having table Punch_List) can call a webhook to add a row to the Jobs table in App B.

When the row is added to the Jobs table in App B, that add can trigger a webhook to update the original Punch_List table record in App A.

I think you are reporting that an error is occurring in the Filter expression you are using in the webhook body template in App B. It is trying to create the webhook call to Edit table Punch_List in App A.

Both webhook calls will work.

However, when you write the webhook body template in App B, you cannot include a FILTER expression that is referring to the Punch_List table in App A. That FILTER expression would need to be evaluated in App B when we create the webhook payload that will be sent to App A. However, App B does not contain the Punch_List table, so we cannot read and filter table Punch_List while running in App B.

It looks like the FILTER expression may not be needed in the webhook body template in App B. Variable [_THISROW].[PUNCH_ID] appears to contain the key of the Punch_List table record you want to update in App A. If you are simply updating that one record, you can remove the <<Start>> and <<End>> from the body template. Just include the single row you want to update inside “Rows” and specify that row’s Punch_List key value as [_THISROW].[PUNCH_ID]

For the sake of documentation should anyone be looking for a similar solution in the future:

When using an webhook whose action is to EDIT a row, specifying ‘_THISROW’ doesn’t appear to be necessary in fact, AppSheet will throw an error that ‘_THISROW’ is not a valid column. Omitting ‘_THISROW’ is the solution and the correct row is updated.

@Phil while I have yet to try it, I am certain the omission of the FILTER expression will work and frankly, I’m baffled as to why I didn’t think of that first?..

Thank you for your help. I appreciate all you and The AppSheet team do.

Top Labels in this Space