Bot to make updates between tables

I have two tables where both have fields for customer id and status. The status in both tables is pulled from a ENUM Ref List.

When a record is added to Table 2 I would like for a Bot to take that status and update the same status for the customer id in Table 1.

I created a Bot to trigger on event type Data Change for Table 2 and only for adds. I then have a step that calls a Update Table 1 process set to Add | Status = [Status].[Status]

Bot_1.png

 Bot_2.png

The Update Table 1 process is set for Table 1 to run a data action to set the row values for the Status column

Bot_3.png

 

This is where I'm stuck as I don't know how to get the Status from Table 2 and update the Status in Table 1 for the same customer id

I get this error message when it does run: Error encountered in step with name [New step]: Error: Row having key '' in table 'Table_1' in field 'Customer Record' is required to have a value

 

Solved Solved
0 7 188
1 ACCEPTED SOLUTION

I understand. 

How about using AppSheet API?

You should first Enable the API. And then, select Run a task > Call a webhook.

chansol_0-1708045314306.png

Target Table Name will be Table 1.

And the request body will be like:

{
  "Action": "Edit",
  "Properties": {
    "Locale": "en-US",
    "Timezone": "Pacific Standard Time"
  },
  "Rows": [
    {
      "Customer ID": "<<[Customer ID]>>",
      "Status": "<<[Status]>>"
    }
  ]
}

 

And headers:

Authorization: "Bearer <<Your Access Key>>"

Content-Type: "application/json"

It will find the Table 1 data where Customer ID is the same to the new added data to Table 2. And then it will update the Status to the new value.

View solution in original post

7 REPLIES 7

Why do you 'call a process', instead of 'Run a data action' directly from the Bot?

I didn't see this before. What do I need to do to reference the status from table 2 to be the input into table 1

 

Bot_4.png

 

Got this configured but its not updating the status in Table 1. I think I have something backwards or not configured correctly

Bot_5.png

 Bot_6.png

 

I understand. 

How about using AppSheet API?

You should first Enable the API. And then, select Run a task > Call a webhook.

chansol_0-1708045314306.png

Target Table Name will be Table 1.

And the request body will be like:

{
  "Action": "Edit",
  "Properties": {
    "Locale": "en-US",
    "Timezone": "Pacific Standard Time"
  },
  "Rows": [
    {
      "Customer ID": "<<[Customer ID]>>",
      "Status": "<<[Status]>>"
    }
  ]
}

 

And headers:

Authorization: "Bearer <<Your Access Key>>"

Content-Type: "application/json"

It will find the Table 1 data where Customer ID is the same to the new added data to Table 2. And then it will update the Status to the new value.

That looks like it would work but getting these errors when the bot runs: Exception":"Webhook HTTP request failed with exception The remote server returned an error: (404) Not Found"

That looks like a common error for folks trying to use the Appsheet API

I'm not sure what's wrong. I made a test app and it works fine.

Please check the setting below.

chansol_0-1708059612755.png

chansol_1-1708059640384.png

chansol_2-1708059680763.png

That's all I did. And here's the result.

1.gif

I copied my app to a new app and the API worked. Thanks for the solution!

Top Labels in this Space