using the DataAssist insert record server behavior, the id is automaticly stored in a session variable.
In the Insert Record Wizard, the Session Variable section allows you to select the ID column from your table and set the name of a session variable that will store the inserted records ID.
In the Insert record behavior for the child table, select the foreign key that relate the parent table and click the lightning bolt next to value. from the session collection, select the session variable that is created by the Insert Record behavior for the parent table.