Update Record Example Deluge Script

Update Record Example Deluge Script

Hi,
I need to write a deluge script to update a Projects task. Since the "update" API asks for "Record Id" , I must fetch the task first, then update it. 
Here the issue is that: I must pick the Task Id from the response object of the getRecords API, turn it into number then use it in update API. This requires coding skills and debug capabilities.

I've tried the below script, but it is not working. 
If you share an example script, it will be a good contribution for me and the community. 


taskName = "Service Request - " + input.ID;
data_map = Map();
data_map.put("name", taskName);
response1 = zoho.projects.getRecords("Zylker", 160XXXXXXX125, "tasks", data_map);

taskId = response1.get("task_id").get(0);

values_map = Map();
values_map.put("percent_complete", 90);
response2 = zoho.projects.update("Zylker" , 160XXXXXXX125, "tasks", taskId, values_map);