How to update custom field for each invoice item by deluge ?

How to update custom field for each invoice item by deluge ?

I have below code to try to update custom field named "Com".
When I run it, I get this error message
"{"code":15,"message":"Please ensure that the invoice_items has less than 100 characters."}"

The reason I tried this way is because I didn't find how to update only "Com" custom field for each item on invoice.
It's best If I can update only that field. (Please let me know If you know this way) but I couldn't find it.
So I just get all invoice_items field and then add new custom field inside then try to update but I get characters limit error.

Please help me if you know how to solve this issue.
Thank you.

  1. invoiceID = invoice.get("invoice_id");
  2. organizationID = organization.get("organization_id");
  3. salesperson_name = invoice.get("salesperson_name");
  4. invoice_items = invoice.get("invoice_items");
  5. custom_fields = invoice.get("custom_fields");
  6. sale_type = "";

  7. for each  item in custom_fields
  8. {
  9. label = item.get("label");
  10. if(label == "Sale Type")
  11. {
  12. sale_type = item.get("value");
  13. }
  14. }
  15. invoice_items = invoice.get("invoice_items");
  16. new_invoice_items = List();

  17. for each item in invoice_items
  18. {
  19. item_custom_fields = item.get("item_custom_fields");
  20. type = "";
  21. for each  item2 in item_custom_fields
  22. {
  23. label = item2.get("label");
  24. if(label == "Type")
  25. {
  26. type = item2.get("value");
  27. }
  28. }
  29. product_name = item.get("name");
  30. splitProductname = product_name.toList("-");
  31. commision_detail = zoho.crm.searchRecords("commsions_structure","(Staff_Member.name:equals:" + salesperson_name + ") and (Product.name:equals:" + splitProductname.get(0) + ") and (Sale_Type:equals:" + sale_type + ") and (Type:equals:" + type + ")");
  32. if(commision_detail.size() > 0)
  33. {
  34. commision = commision_detail.get(0).get("Commission");
  35. }
  36. CustomField = Map();
  37. CustomField.put("label","Com");
  38. CustomField.put("value",5);
  39. item.put(CustomField);
  40. new_invoice_items.add(item);
  41. }

  42. test = List();
  43. test.add(new_invoice_items);

  44. values = Map();
  45. values.put("invoice_items",test);

  46. response = zoho.invoice.update("Invoices",organizationID,"3878353000003769092",values,"zohoinvoice");
  47. info response;

    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方