Insert action blocks

If I have an action block on a table for the insert action, and that logic block does NOT insert the record, should I expect that record to not be inserted?
Context, there is a Work Table that is setup this way, and on save of the app we get the error “Cannot insert live records into a work table”. I wouldn’t expect that the insert would be attempted.

You are correct in that if your action block does not perform an Insert action, that your record will not be inserted. Think of action blocks as taking over the save from the platform. When you define an action block, you are now in charge of the record.

As to the “cannot insert live records into work table” error that you got, that is also expected if you did not define an action block. Work tables only hold pending records and you must define an action block over the table to do something with the records on save - you get to decide what that something is. You can either move the data to its true destination (for example: via an Insert action into another table that is not a Work table) or essentially throw away the data by doing nothing in your action block.

If you do not define an action block over a work table, the platform will try to insert/update/etc the record as usual in the table, and we’ll throw an error when that is attempted.

1 Like