I would like to copy an entire row, including...

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?

0 4 387
4 REPLIES 4

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.

Top Labels in this Space