a!writeToDataStoreEntity

I am trying to use a!writeToDataStoreEntity   to write to into a database , if one on the fields is a (foreign key) which is an auto-generated primary key of another table in the "same interface ", how can i pass it to the other table when it  hasn't been generated yet?   

  Discussion posts and replies are publicly visible