Error in Deluge script, but all should be OK

Error in Deluge script, but all should be OK

I get an error when using the following deluge script (sensitive info changed with ***).

This script should parse a projectnumber out of the subject or body text and put it in a custom field of the ticket.

The error:
Validation failed for the condition : Syntax error. Expecting ']' or invokeurl parameter values. Found ','.. LineNumber : 10

The code:
  1. // Validate ticketId (numeric)
  2. if (ticketId == null) {
  3.     info "Error: ticketId is null"; 
  4.     return;
  5. }

  6. // Fetch ticket details
  7. try {
  8.     ticketDetails = invokeurl [
  9.         url: "https://***.nl/api/v1/tickets/" + ticketId,
  10.         type: GET,
  11.         connection: "myapi"
  12.     ];
  13. } catch (e) {
  14.     info "Fetch ticketDetails Error: " + e;
  15.     return;
  16. }

  17. // Fetch latest thread
  18. try {
  19.     threadDetails = invokeurl [
  20.         url: "https://***.nl/api/v1/tickets/" + ticketId + "/latestThread?include=plainText",
  21.         type: GET,
  22.         connection: "myapi"
  23.     ];
  24. } catch (e) {
  25.     info "Fetch threadDetails Error: " + e; 
  26.     return;
  27. }

  28. // Extract content and initialize
  29. ticketSubject = ticketDetails.get("subject"); 
  30. ticketBody = threadDetails.get("plainText"); 
  31. projectNumber = ""; 

  32. info "Subject/Body: " + ticketSubject + " | " + ticketBody;

  33. // Search in subject for B + 5 digits
  34. if (ticketSubject != null && ticketSubject != "" && ticketSubject.length() >= 6) {
  35.     len = ticketSubject.length();
  36.     maxStart = len - 6;
  37.     for idx = 0; idx <= maxStart; idx = idx + 1 {
  38.         candidate = ticketSubject.substring(idx, idx + 6);
  39.         if (candidate.substring(0,1).toUpperCase() == "B" && candidate.substring(1,6).matches("\\d{5}")) {
  40.             projectNumber = candidate;
  41.             break;
  42.         }
  43.     }
  44. }

  45. // If not found in subject, search in body
  46. if (projectNumber == "" && ticketBody != null && ticketBody != "" && ticketBody.length() >= 6) {
  47.     len = ticketBody.length();
  48.     maxStart = len - 6;
  49.     for idx = 0; idx <= maxStart; idx = idx + 1 {
  50.         candidate = ticketBody.substring(idx, idx + 6);
  51.         if (candidate.substring(0,1).toUpperCase() == "B" && candidate.substring(1,6).matches("\\d{5}")) {
  52.             projectNumber = candidate;
  53.             break;
  54.         }
  55.     }
  56. }

  57. info "projectNumber: " + projectNumber;

  58. // Update custom field if found
  59. if (projectNumber != "") {
  60.     customFieldsMap = Map(); 
  61.     customFieldsMap.put("cf_b_nummer", projectNumber);
  62.     updateData = Map(); 
  63.     updateData.put("customFields", customFieldsMap);

  64.     try {
  65.         invokeurl [
  66.             url: "https://***.nl/api/v1/tickets/" + ticketId,
  67.             type: PATCH,
  68.             headers: {"Content-Type":"application/json"},
  69.             parameters: updateData,
  70.             connection: "myapi"
  71.         ];
  72.         info "Project number updated successfully";
  73.     } catch (e) {
  74.         info "Update Error: " + e;
  75.     }
  76. }
Somebody knows where to look? I really don't understand whats wrong with the script. The invokeurl is correctly formatted.
    • 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