Add record of editable table based on input variable

I have a "Detail" page which lists records for a particular entity based on an input variable from the page before (which i've clicked on a link).

In this Detail page I have an editable table at the bottom which should list the records associated to the input variable. I am finding that whenever I click on Add Record, it will keep adding a value of 0 to the foreign key field but I am expecting it to add a value of 1 (which is the Id of the entity I am adding records for).

I've even tried creating an input widget in the editable table in the first cell and tried to set the variable as the input variable but it is expecting a text whereas the input var is an Identifer. 

Any idea?

I found a work around which kind of does the job.

Instead of the input widget, I am now using a combo box and then setting the source record list to the aggregate from the preparation, then set the source attribute to the entity Id, and then finally set the variable of the combo box to the table current list foreign key field.

The only problem with this is that the user can modify the foreign key because it is an editable combo box.