Update Record Example Deluge Script

Update Record Example Deluge Script

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);

    Zoho Developer Community

                              Zoho Desk Resources

                              • Desk Community Learning Series

                              • Digest

                              • Functions

                              • Meetups

                              • Kbase

                              • Resources

                              • Glossary

                              • Desk Marketplace

                              • MVP Corner

                              • Word of the Day

                                  Zoho Marketing Automation

                                          Manage your brands on social media

                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources

                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources

                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources

                                                            Zoho Sprints Resources

                                                              Qntrl Resources

                                                                Zoho Creator Resources

                                                                  Zoho WorkDrive Resources

                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series

                                                                      • Tips


                                                                      • Functions


                                                                      • Meetups


                                                                      • Kbase


                                                                      • Resources


                                                                      • Digest


                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner



                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now