How to add Editable Grid rows in database with corresponding primary key value


I have created one CDT and it's first column is auto generated primary key and the same CDT is used to store the column values of the editable grid.

I have used the below code:

Here "Slot Id" is primary key of CDT stored in the newGridRow local variable. I don't want to display this primary key column as editable grid column but want to store the value of this primary key along with the remaining editable grid columns in the database table.

I have Write to Datastore Entity smart service. It is adding the new row to the database table with auto incremented primary key but not adding the values of other columns of editable grid in the table. 

Please help me. 

  Discussion posts and replies are publicly visible