Timer Task

I have created a timer on a task and I'd like to get activityInstanceid from the timer groovy script.
When I test it activityInstanceid = -1 
Can you explain me why ? and how to process to get task id associate to the timer ?

Thanks