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.
- invoiceID = invoice.get("invoice_id");
- organizationID = organization.get("organization_id");
- salesperson_name = invoice.get("salesperson_name");
- invoice_items = invoice.get("invoice_items");
- custom_fields = invoice.get("custom_fields");
- sale_type = "";
- for each item in custom_fields
- {
- label = item.get("label");
- if(label == "Sale Type")
- {
- sale_type = item.get("value");
- }
- }
- invoice_items = invoice.get("invoice_items");
- new_invoice_items = List();
- for each item in invoice_items
- {
- item_custom_fields = item.get("item_custom_fields");
- type = "";
- for each item2 in item_custom_fields
- {
- label = item2.get("label");
- if(label == "Type")
- {
- type = item2.get("value");
- }
- }
- product_name = item.get("name");
- splitProductname = product_name.toList("-");
- 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 + ")");
- if(commision_detail.size() > 0)
- {
- commision = commision_detail.get(0).get("Commission");
- }
-
- CustomField = Map();
- CustomField.put("label","Com");
- CustomField.put("value",5);
- item.put(CustomField);
- new_invoice_items.add(item);
- }
- test = List();
- test.add(new_invoice_items);
- values = Map();
- values.put("invoice_items",test);
- response = zoho.invoice.update("Invoices",organizationID,"3878353000003769092",values,"zohoinvoice");
- info response;
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
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
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.