Iteration through a list - Coming up against a "Failure to update function" error

Iteration through a list - Coming up against a "Failure to update function" error

Hi there! I've been attempting to get a deluge script working and am running into an error that I have been unable to resolve. The error I am getting is

  1. Failed to update function
  2. Error at line :18. Improper Statement. Error might be due to missing ';' at end of the line or incomplete expression Line Number : 16Failed to update function
  3. Error at line :18. Improper Statement. Error might be due to missing ';' at end of the line or incomplete expression Line Number : 16

Here is my script:

  1. // Organization ID
  2. OrgID = xxxxxxxxxx;

  3. //Input parameters - Retrieve record and account info and consultant full name from account. Write team ID to variable.
  4. record = zoho.desk.getRecordById(OrgID,"tickets",ticket_id);
  5. account = zoho.desk.getRecordById(OrgID,"accounts",schools_id);
  6. customer_success_consultant = account.get("cf").get("cf_custome_success_consultant");
  7. team_id = 19368xxxxxxxxxxxx; //Hardcoded permanently - Value never changes

  8. //Initialise loop variables
  9. index_value = 0;
  10. page_size = 10;
  11. iterations = 100; //increase this number if we ever have more than 1000 agents in Zoho. This will scan through iterations x 10 records.
  12. iterationString = "".leftPad(iterations).replaceAll(" ",",").toList().subList(0,iterations);

  13. for each iteration in iterationString{
  14. //fetch records in batches of 10
  15. user_records = zoho.desk.getRecords(OrgID, "agents", index_value, page_size,{"searchStr":customer_success_consultant});
  16. resp = user_records.getJson("data");
  17. resp_list = resp.toJSONList();

  18. //Exit loop if no records are found
  19. if (resp_list.isEmpty()){
  20. info "No more records to process. Exiting loop";
  21. break;
  22. }

  23. //Process the returned record if found
  24. if (!resp_list.isEmpty()){
  25. for each user in resp_list
  26. {
  27. if(user.get("name") == customer_success_consultant)
  28. {
  29. user_id = user.getJson("id");
  30. info "User found!";
  31. }
  32. }
  33. index_value = index_value + page_size;
  34. }

  35. }

  36. record_value = {"teamId":team_id,"assigneeId":user_id};
  37. update_ticket = zoho.desk.update(OrgID,"tickets",ticket_id,record_value);
I had this successfully working before attempting to iterate through pages of results, so I know the query to retrieve agents and the ticket update functions on lines 43 and 44 work - I just cannot get the iteration to progress.

Any assistance would be greatly appreciated!

      • Sticky Posts

      • Zoho Desk Partners with Microsoft's M365 Copilot for seamless customer service experiences

        Hello Zoho Desk users, We are happy to announce that Zoho Desk has partnered with Microsoft's M365 to empower customer service teams with enhanced capabilities and seamless experiences for agents. Microsoft announced their partnership during their keynote
      • WhatsApp pricing changes: Pay per message starting July 1, 2025

        Starting July 1, 2025, WhatsApp is shifting from conversation-based pricing to per-message billing. That means every business-initiated message you send will count. Not just the first one in a 24-hour window. Pricing updates on the WhatsApp Business Platform
      • Live Webinar - Work smarter with Zoho Desk and Zoho Workplace integration

        Hello customers! Zoho Desk and Zoho Workplace are coming together for a webinar on 14th May, 2024. Zoho Workplace is a suite of productivity apps for email, chat, docs, calls, and more at one single place. Zoho Desk is closely integrated with a few tools
      • Apple iOS 17 and iPadOS 17 updates for Zoho Desk users

        Hello Zoho Desk users! Apple recently announced the release of iOS 17 and iPad OS 17. These latest OS updates will help you stay productive and efficient, through interactive and seamless user experiences. Zoho Desk has incorporated the updates to help
      • Zoho Desk Cheat Sheet For The Year-End

        Check out these Zoho Desk best practices to end this year on a high and have a great one ahead! #1 Set Business (Holiday) Hours - If you have limited working hours, please make sure you restrict your business hours or set them as holidays for the coming days. Let your customers know when you will, and won't, be available. #2 Update the Annual Holiday List - Check the holidays for the new year and update the holiday schedule. Usually, holidays from the current year will be carried over for the next