How do I empty subtable with workflow

I’m trying to empty subtable in workflow with this:
var i = 1;
for (i; entry.getSubtableFieldValue(“1000799”, i, “1000797”) != null; i++)
entry.deleteSubtableRow(“1000799”, i);
but the first row will always remain there. I had try i = 0, but it seems won’t work.

You can try this to delete everything:


No need for loop.

1 Like

But for future reference when dealing with subtables and arrays, they’re almost always start index at 0, not 1.

0: “item 1”,
1: “item 2”,

1 Like


You can use deleteSubtableRowAll to empty the subtable in workflow. For deleting one row, you can use deleteSubtableRow instead.

Best Regards,