Building a Form system with templates

Hello there, i’m trying to build a Form system which will work as follows:

There are two template tables [FORM_TMP_MASTER, FORM_TMP_DET] and these contains some predefined values that will be used to fill the values of the respective columns when an actual form is created. Now there are also two other tables responsible for handling the actual creation of a Form [FORM_MASTER, FORM_DET].

When a user creates a form he can select a template (from the FORM_TMP_MASTER) and i want to find all the children of that tmp_master table (form_tmp_details) and create a FORM_DET row for each one while linking it to the newly created form. I’m currently using Workflows & Actions to find a solution and i think i’m on the right path. Here’s what i’ve got:

When a new ADD happens on the FORM_MASTER table, i run the following two actions using a workflow:


Now i’ve managed to create a FORM_DET row for each row in the FORM_TMP_DETAILS table (if it’s a child of the selected FORM_TMP_MASTER) and transfer the [Name] column’s values. However, how would i connect the newly created FORM_DET rows with their newly created FORM_MASTER?