You can use a Webhook and the API to copy data from an updated records to an existing record in another table.

This example uses two identical tables called "People" and "PeopleEcho".  Both tables contains four identical fields named "Name", "Age", "DropDown", and "Count". Admittedly this example is simple and contrived, but it illustrates how you can use the same approach in more complex cases.

Every time an existing record is updated in the "People" table, the webhook is triggered. The webhook uses the API to update the corresponding record into the "PeopleEcho" table. This ensure that the two records have identical field values.

Do this as follows:

  1. Go to the Manage > Integrations > IN pane and enabled the input integration.
  2. Go to the Behavior > Workflow pane and add a "Webhook" rule.
  3. In the webhook "Target data" property choose the "People" table.
  4. In the webhook "Update event" property choose "UPDATES_ONLY".
  5. In the webhook "Url" property enter:
    https://api.appsheet.com/api/v1/apps/ad178014-1282-4055-bf14-505e31c90c73/tables/PeopleEcho/Action

    Where the App Id following "apps/" is the "App Id" from the Manage > Integrations > IN pane.

    The value following "tables/" is the name of the target table. In this case, "PeopleEcho".
  6. In the webhook "HTTP Verb" property enter "Post".
  7. In the webhook "HTTP Headers" property enter:
    applicationAccessKey: "C2iXO-RjfVq-PmcLy-d7nil-YiLvt-BCAYy-C04LY-Ynt0q"

    Where the access key value is the "Access Key" from the Manage > Integrations > IN pane. The "Access Key" must be enclosed in quotes.
  8. Create a "JSON Body Template" that looks like this:

    {
      "Action": "Edit",
      "Properties": {
        "Locale": "en-US",
        "Timezone": "Eastern Standard Time"
      },
      "Rows": [
        {
          "Name": "<<[Name]>>",
          "Age": "<<[Age]>>",
          "DropDown": "<<[DropDown]>>",
          "Count": "<<[Count]>>"
        }
      ]
    }

    This JSON Body Template copies the value of the "Name" field of table "People" to the "Name" field of table "PeopleEcho". Ditto for the other three fields.

    This example, is simply copying the entire record from "People" to "PeopleEcho" but you could do other things. You could copy a subset of the fields by omitting one or more field names from the JSON Body Template. Fields that you omit are not changed.

    You must include values in the key fields of the updated table. These key values are used to locate the record to be updated.

Creating the JSON Body Template

If you click the "Create" button following the "JSON Body Template" property, AppSheet will create an initial JSON Body Template which you can then modify. The template is based on the fields of the table you specify in the "Target data" property.

The following technique can simplify template creation.

  1. Temporarily change the "Target data" property to the table you want to use for the template.
  2. Click "Save" to save the temporary change.
  3. Click the "Create" button to create the template.
  4. Restore the  "Target data" property to its original value.
  5. Click "Save" to save all changes.

Troubleshooting Your Webhook and API

  1. You can troubleshoot your webhook as described here.
  2. You can troubleshoot your API as described here.
Did this answer your question?