Hi mate, apologies for not providing details on the “doesn’t do the trick” part. Anyway, your code is similar to what I did in using GlobalVariables. The stup*d thing is that I didn’t do proper debug and checking that the actual value from the API (Response body) is passed into @BeforeTestCase.
The passing of value from @BeforeTestCase to @AfterTestCase works using GlobalVariables.
Thanks anyway for spending time responding to my query and happy holidays.