New method to get variables for task instance