I am trying to get the test id from a defect that was open through a test run. In 8.2 this test id was stored in the field bug_test_reference which is obsolet in 10. I was told to move my code to dialogbox in common scripts and to acces the new link table which holds bug id, entity type, and entity id. The problem is though, that when a defect is opened in this way, at the stage in dialogbox I am in - it's before the submit. So, there is a bug instance, but not a bug id. Furthermore, if there is no bug id, there is still no record in the link table.
Any idea how to get around this?