I would like to copy an entire row, including its child-records, without going through a form.
I can add the parent-records via API. For the child-record, I can do that if it is a fixed number. i.e., for 3 rows, make a function with SELECT and INDEX for position 1, 2 and 3.
If its not a fixed number of child-records, to select on child-table and add each child-record I think would need some kind of loop function on the HTTP body.
Is it possible to do that? How can I do it?
Check this article to see if itโll help you out. help.appsheet.com - Template Start Expressions Template Start Expressions help.appsheet.com
Agree with Marc; also this document says you could use <> tag in JSON Template for invoking AppSheet API: help.appsheet.com - Invoking Webhooks from a Workflow Rule or Scheduled Report Invoking Webhooks from a Workflow Rule or Scheduled Report help.appsheet.com
Hello!
Iโve tried start expressions but I havenโt been able to make it work.
The API url requests the {tableName}, it will only make changes to this table, so I created 2 webhook workflows, one for the parent table and one for the child table, both triggered by the same event on the parent table.
The one for the parent table works fine. For the child table, I made the JSON template below, but on the audit log I always find this error:
โResultErrorโ: โREST API REST API invoke request failed: No API โRowsโ are present.โ,
Maybe is the way I wrote it. The position of the "[]"s and "{}"s might be wrong. Iโve used Start Expressions for pdf templates, but for JSON I havenโt figured out how to use and the links I found doesnโt say much about it.
{
โActionโ: โAddโ,
โPropertiesโ: {
โLocaleโ: โpt-BRโ,
โTimezoneโ: โUTCโ
},
<<Start: [Parent_key].[Related Childs]>>
{
โRowsโ: [
{
โCollumn1โ: โ<<[Collumn1]>>โ,
โCollumn2โ: โ<<[Collumn2]>>โ,
}
]
}
<> }
Maybe put the <> expression inside of the Rows bracket. Like this:
Rows [ <> {"โcolโ:โvalโ,โcol2โ:โval2โ }, <>]
As you have it now, the Row property of the http body is being repeated for every child record, you just want the repetition to be for your column & value settings.
User | Count |
---|---|
41 | |
31 | |
31 | |
16 | |
14 |