foreign key null value in script task

I have "requestID" as a foreign key in 2 tables "attachment" and "Document"  i passed it as process variable through a task script. When i debug the process it works but it saves the foreign key "Null". 

what might be the reason? 

  Discussion posts and replies are publicly visible