Creating a list or relations inside a form

i have 2 tables deckarations and actions
I want to let the customer provide a list of actions (in grid view) when creating a new declaration(in the form itself) and so the actions will be linked to the declaration.
the problem is i can’t find a way to create this link as i do not have the rowid of the declaration before it’s submitted.
Is there a way to do that?

What I would do is use a custom form.

On entry to opening the form screen, set a " Unique Identifier" value to a column. That can become the link between your “declarations” and “actions”.

When you add a row for the declaration, make sure you get the “Unique Identifier” value in as a column. Same thing for actions. Then you can have a relation between those 2.