Zoho Books: Please ensure that the "description" has less than 100 characters.

Zoho Books: Please ensure that the "description" has less than 100 characters.

I have this code written to convert Quote into an invoice and keep getting an error even while saving the code. 

Error: Please ensure that the "description" has less than 100 characters.

  1. // Replace with your actual organization ID and connection name
  2.     org_id = "7004318259";
  3.     connection_name = "zohobooks";

  4.     // Fetch the quote details using the provided quote_id
  5.     quote_response = zoho.books.getRecordsByID("Estimates", org_id, quote_id, connection_name);
  6.     estimate = quote_response.get("estimate");

  7.     if (estimate.isEmpty())
  8.     {
  9.         info "Quote not found for ID: " + quote_id;
  10.         return;
  11.     }

  12.     // Extract key details from the quote
  13.     customer_id = estimate.get("customer_id");
  14.     zcrm_potential_id = estimate.get("zcrm_potential_id");
  15.     if(zcrm_potential_id != "" && zcrm_potential_id != null)
  16.     {
  17.         deals = zoho.crm.getRecordById("Deals",zcrm_potential_id);
  18.         What_type_of_job_is_this = deals.get("What_type_of_job_is_this");
  19.     }
  20.     estimate_id = estimate.get("estimate_id");
  21.     estimate_number = estimate.get("estimate_number");
  22.     currency_id = estimate.get("currency_id");
  23.     line_items = estimate.get("line_items");

  24.     // Initialize lists to hold Supply and Installation items
  25.     if(What_type_of_job_is_this == "Mixed Scope (Supply + Install)")
  26.     {
  27.         supply_items = List();
  28.         installation_items = List();

  29.         // Filter line items based on Item Category
  30.         for each  item in line_items
  31.         {
  32.             // Access the custom field "Item Category"
  33.             custom_fields = item.get("item_custom_fields");
  34.             item_category = "";
  35.             for each  cf in custom_fields
  36.             {
  37.                 if(cf.get("label") == "Item Category")
  38.                 {
  39.                     item_category = cf.get("value");
  40.                     break;
  41.                 }
  42.             }

  43.             // Create an item map for invoice creation, including tax
  44.             item_map = Map();
  45.             item_map.put("item_id",item.get("item_id"));
  46.             item_map.put("quantity",item.get("quantity"));
  47.             item_map.put("rate",item.get("rate"));
  48.             item_map.put("tax_id",item.get("tax_id"));
  49.             // Include tax ID (e.g., GST)
  50.             description = item.get("description");
  51.             if(description.length() > 100)
  52.             {
  53.                 description = description.subString(0,100); // Truncate to 100 characters
  54.             }
  55.             item_map.put("description",description);
  56.             // Optional: from quote, limited to 100 characters
  57.             item_map.put("unit",item.get("unit"));
  58.             // Optional: from quote

  59.             if(item_category.equalsIgnoreCase("Supply"))
  60.             {
  61.                 supply_items.add(item_map);
  62.             }
  63.             else if(item_category.equalsIgnoreCase("Installation"))
  64.             {
  65.                 installation_items.add(item_map);
  66.             }
  67.         }

  68.         // Prepare common invoice details
  69.         current_date = today;
  70.         current_date = current_date.toString("yyyy-MM-dd");
  71.         // Format for API
  72.         due_date = addDay(current_date,30).toString("yyyy-MM-dd");

  73.         // API URL for Zoho Books Invoices endpoint
  74.         base_url = "https://www.zohoapis.com.au/books/v3/invoices?organization_id=" + org_id;

  75.         // Create Supply Invoice if there are Supply items
  76.         if(!supply_items.isEmpty())
  77.         {
  78.             supply_invoice_map = Map();
  79.             supply_invoice_map.put("customer_id",customer_id);
  80.             supply_invoice_map.put("currency_id",currency_id);
  81.             supply_invoice_map.put("date",current_date);
  82.             supply_invoice_map.put("due_date",due_date);
  83.             supply_invoice_map.put("line_items",supply_items);
  84.             supply_invoice_map.put("reference_number","SUP-" + estimate_number);
  85.             supply_invoice_map.put("notes",estimate.get("notes"));
  86.             supply_invoice_map.put("terms",estimate.get("terms"));
  87.             supply_invoice_map.put("invoiced_estimate_id",estimate_id);
  88.             // Link to estimate
  89.             supply_invoice_map.put("zcrm_potential_id",zcrm_potential_id);
  90.             // CRM deal link
  91.             supply_invoice_map.put("ignore_auto_number_generation",false);
  92.             // Auto-generate invoice number
  93.             supply_invoice_map.put("is_inclusive_tax",false);
  94.             // Match your sample
  95.             supply_invoice_map.put("discount",0);
  96.             // From quote
  97.             supply_invoice_map.put("shipping_charge",0);
  98.             // From quote
  99.             supply_invoice_map.put("adjustment",0);
  100.             // From quote

  101.             // Convert map to JSON string for API
  102.             parameters_data = supply_invoice_map.toString();

  103.             // Invoke URL to create Supply Invoice
  104.             response = invokeurl
  105.             [
  106.                 url :base_url
  107.                 type :POST
  108.                 parameters:parameters_data
  109.                 connection:"zohobooks"
  110.             ];
  111.             info response;
  112.         }

  113.         // Create Installation Invoice if there are Installation items
  114.         if(!installation_items.isEmpty())
  115.         {
  116.             installation_invoice_map = Map();
  117.             installation_invoice_map.put("customer_id",customer_id);
  118.             installation_invoice_map.put("currency_id",currency_id);
  119.             installation_invoice_map.put("date",current_date);
  120.             installation_invoice_map.put("due_date",due_date);
  121.             installation_invoice_map.put("line_items",installation_items);
  122.             installation_invoice_map.put("reference_number","INST-" + estimate_number);
  123.             installation_invoice_map.put("notes",estimate.get("notes"));
  124.             installation_invoice_map.put("terms",estimate.get("terms"));
  125.             installation_invoice_map.put("invoiced_estimate_id",estimate_id);
  126.             // Link to estimate
  127.             installation_invoice_map.put("zcrm_potential_id",zcrm_potential_id);
  128.             // CRM deal link
  129.             installation_invoice_map.put("ignore_auto_number_generation",false);
  130.             // Auto-generate invoice number
  131.             installation_invoice_map.put("is_inclusive_tax",false);
  132.             // Match your sample
  133.             installation_invoice_map.put("discount",0);
  134.             // From quote
  135.             installation_invoice_map.put("shipping_charge",0);
  136.             // From quote
  137.             installation_invoice_map.put("adjustment",0);
  138.             // From quote

  139.             // Convert map to JSON string for API
  140.             parameters_data = installation_invoice_map.toString();

  141.             // Invoke URL to create Installation Invoice
  142.             response = invokeurl
  143.             [
  144.                 url :base_url
  145.                 type :POST
  146.                 parameters:parameters_data
  147.                 connection:"zohobooks"
  148.             ];
  149.             info response;
  150.         }
  151.     }
  152.     else
  153.     {
  154.         supply_items = List();

  155.         // Create an item map for invoice creation, including tax
  156.         for each  item in line_items
  157.         {
  158.             // Create an item map for invoice creation, including tax
  159.             item_map = Map();
  160.             item_map.put("item_id",item.get("item_id"));
  161.             item_map.put("quantity",item.get("quantity"));
  162.             item_map.put("rate",item.get("rate"));
  163.             item_map.put("tax_id",item.get("tax_id"));
  164.             // Include tax ID (e.g., GST)
  165.             description = item.get("description");
  166.             if(description.length() > 100)
  167.             {
  168.                 description = description.subString(0,100); // Truncate to 100 characters
  169.             }
  170.             item_map.put("description",description);
  171.             // Optional: from quote, limited to 100 characters
  172.             item_map.put("unit",item.get("unit"));
  173.             supply_items.add(item_map);
  174.         }

  175.         // Prepare common invoice details
  176.         current_date = today;
  177.         current_date = current_date.toString("yyyy-MM-dd");
  178.         // Format for API
  179.         due_date = addDay(current_date,30).toString("yyyy-MM-dd");

  180.         // API URL for Zoho Books Invoices endpoint
  181.         base_url = "https://www.zohoapis.com.au/books/v3/invoices?organization_id=" + org_id;

  182.         // Create Supply Invoice if there are Supply items
  183.         supply_invoice_map = Map();
  184.         supply_invoice_map.put("customer_id",customer_id);
  185.         supply_invoice_map.put("currency_id",currency_id);
  186.         supply_invoice_map.put("date",current_date);
  187.         supply_invoice_map.put("due_date",due_date);
  188.         supply_invoice_map.put("line_items",supply_items);
  189.         supply_invoice_map.put("reference_number",estimate_number);
  190.         supply_invoice_map.put("notes",estimate.get("notes"));
  191.         supply_invoice_map.put("terms",estimate.get("terms"));
  192.         supply_invoice_map.put("invoiced_estimate_id",estimate_id);
  193.         // Link to estimate
  194.         supply_invoice_map.put("zcrm_potential_id",zcrm_potential_id);
  195.         // CRM deal link
  196.         supply_invoice_map.put("ignore_auto_number_generation",false);
  197.         // Auto-generate invoice number
  198.         supply_invoice_map.put("is_inclusive_tax",false);
  199.         // Match your sample
  200.         supply_invoice_map.put("discount",0);
  201.         // From quote
  202.         supply_invoice_map.put("shipping_charge",0);
  203.         // From quote
  204.         supply_invoice_map.put("adjustment",0);
  205.         // From quote

  206.         // Convert map to JSON string for API
  207.         parameters_data = supply_invoice_map.toString();

  208.         // Invoke URL to create Supply Invoice
  209.         response = invokeurl
  210.         [
  211.             url :base_url
  212.             type :POST
  213.             parameters:parameters_data
  214.             connection:"zohobooks"
  215.         ];
  216.         info response;
  217.     }
    • Recent Topics

    • No practical examples of how survey data is analyzed

      There are no examples of analysis with analytics of zoho survey data. Only survey meta data is analyzed, such as number of completes, not actual analysis of responses, such as the % in each gender, cross-tabulations of survey responses. One strange characteristic of Zoho analytics is that does not seem aware of how Zoho Survey codes 'multiple response' questions. These are questions where more than one option can be selected from a list. Zoho Survey stores this data as text, separated by commas within
    • Update application by uploading an updated DS file

      Is it possible? I have been working with AI on my desktop improving my application, and I have to keep copy pasting stuff... Would it be possible to import the DS file on top of an existing application to update the app accordingly?
    • Markdown support, code cells...

      Hi Zoho I'd like to vote for a feature that markdown is supported with: Headings Code highlighting Quoteblocks ... Furthermore a inline card(like inline sketch card) for special text like Code would be great. And just to add my vote as well for "Tags"!
    • Minimise chat when user navigates to new page

      When the user is in an active chat (chatbot) and is provide with an internal link, when they click the link to go to the internal page the chat opens again. This is not a good user experience. They have been sent the link to read what is on the page.
    • How do I fix this? Unable to send message; Reason:554 5.1.8 Email Outgoing Blocked.

      How do I fix this? Unable to send message; Reason:554 5.1.8 Email Outgoing Blocked.
    • Reports: Custom Search Function Fields

      Hi Zoho, Hope you'll add this into your roadmap. Issue: For the past 2yrs our global team been complaining and was brought to our attention recently that it's a time consuming process looking/scrolling down. Use-case: This form is a service report with
    • Zoho Projects app update: Voice notes for Tasks and Bugs module

      Hello everyone! In the latest version(v3.9.37) of the Zoho Projects Android app update, we have introduced voice notes for the Tasks and Bugs module. The voice notes can be added as an attachment or can be transcribed into text. Recording and attaching
    • zurl URL shortener Not working in Zoho social

      zurl URL shortener Not working in while creating a post in Zoho social
    • In the Zoho CRM Module I have TRN Field I should contain 15 digit Number , If it Contain less than 15 digit Then show Alert message on save of the button , If it not contain any number not want to sh

      Hi In the Zoho CRM Module I have TRN Field I should contain 15 digit Number , If it Contain less than 15 digit Then show Alert message on save of the button , If it not contain any number not want to show alert. How We can achive in Zoho CRm Using custom
    • Power of Automation::Streamline log hours to work hours upon task completion.

      Hello Everyone, A Custom Function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as to when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it. Requirement:-
    • Zoho Bookings know-how: A hands-on workshop series

      Hello! We’re conducting a hands-on workshop series to help simplify appointment scheduling for your business with Zoho Bookings. We’ll be covering various functionalities and showing how you can leverage them for your business across five different sessions.
    • Custom report

      Hello Everyone I hope everything is fine. I've tried to To change the layout of the reports, especially the summary page report, and I want to divide summary of each section in the survey but I can't For example: I have a survey containing five different
    • Zoho Journey - ZOHO MARKETING AUTOMATION

      I’ve encountered an issue while working with a journey in Zoho Marketing Automation. After creating the journey, I wanted to edit the "Match Criteria" settings. Unfortunately: The criteria section appears to be locked and not editable. I’m also unable
    • Custom Fields in PDF outputs

      I created a couple of custom fields. e.g Country of Origin and HS Tariff Code. I need these to appear on a clone of a sales order PDF template but on on the standard PDF template. When I select "appear on PDFs' it appears on both but when I don't select
    • How to create a Service Agreement with Quarterly Estimate

      Hello, I'm not sure if this has been asked before so please don't get mad at me for asking. We're an NDIS provider in Australia so we need to draft a Service Agreement for our client. With the recent changes in the NDIS we're now required to also include
    • Change Currency symbol

      I would like to change the way our currency displays when printed on quotes, invoices and purchase orders. Currently, we have Australian Dollars AUD as our Home Currency. The only two symbol choices available for this currency are "AU $" or "AUD". I would
    • Python - code studio

      Hi, I see the code studio is "coming soon". We have some files that will require some more complex transformation, is this feature far off? It appears to have been released in Zoho Analytics already
    • Zoho Social - Post Footer Templates

      As a content creator I often want to include some information at the end of most posts. It would be great if there was an option to add pre-written footers, similar to the Hashtag Groups at the end of posts. For example, if there is an offer I'm running
    • Allow to pick color for project groups in Zoho Projects

      Hi Zoho Team, It would be really helpful if users could assign colors to project groups. This would make it easier to visually distinguish groups, improve navigation, and give a clearer overview when managing multiple projects. Thanks for considering
    • Zoho Books - Quotes to Sales Order Automation

      Hi Books team, In the Quote settings there is an option to convert a Quote to an Invoice upon acceptance, but there is not feature to convert a Quote to a Sales Order (see screenshot below) For users selling products through Zoho Inventory, the workflow
    • Can't find imported leads

      Hi There I have imported leads into the CRM via a .xls document, and the import is showing up as having been successful, however - when I try and locate the leads in the CRM system, I cannot find them.  1. There are no filters applied  2. They are not
    • Custom Button Disappearing in mobile view | Zoho CRM Canvas

      I'm working in Zoho CRM Canvas to create a custom view for our sales team. One of the features I'm adding is a custom button that opens the leads address in another tab. I've had no issue with this in the desktop view, but in the mobile view the button
    • The connected workflow is a great idea just needs Projects Integrations

      I just discovered the connected workflows in CRM and its a Great Idea i wish it was integrated with Zoho Projects I will explain our use case I am already trying to do something like connected workflow with zoho flow Our requirement was to Create a Task
    • Zoho Projects MCP Feedback

      I've started using the MCP connector with Zoho Projects, and the features that exist really do work quite well - I feel this is going to be a major update to the Zoho Ecosystem. In projects a major missing feature is the ability to manage, (especially
    • Function #10: Update item prices automatically based on the last transaction created

      In businesses, item prices are not always fixed and can fluctuate due to various factors. If you find yourself manually adjusting the item rates every time they change, we have the ideal time-saving solution for you. In today's post, we bring you custom
    • email template

      How do I create and save an email template
    • Enhancements in Portal User Group creation flow

      Hello everyone, Before introducing new Portal features, here are some changes to the UI of Portals page to improve the user experience. Some tabs and options have been repositioned so that users can better access the functionalities of the feature. From
    • Archiving Contacts

      How do I archive a list of contacts, or individual contacts?
    • How do I filter contacts by account parameters?

      Need to filter a contact view according to account parameter, eg account type. Without this filter users are overwhelmed with irrelevant contacts. Workaround is to create a custom 'Contact Type' field but this unbearable duplicity as the information already
    • Can I add Conditional merge tags on my Templates?

      Hi I was wondering if I can use Conditional Mail Merge tags inside my Email templates/Quotes etc within the CRM? In spanish and in our business we use gender and academic degree salutations , ie: Dr., Dra., Sr., Srta., so the beginning of an email / letter
    • Zoho CRM button to download images from image upload field

      Hello, I am trying to create a button in Zoho CRM that I can place in my record details view for each record and use it to download all images in the image upload fields. I tried deluge, client scripts and even with a widget, but feel lost, could not
    • email moderation issue when email is sent in the name of a mail group

      Symptom: an email that is sent by a mail group moderator in the name of a moderated mail group is held back for approval. Reproduction: Create a moderated mail group with members and moderators. Allow that mails can be sent in the name of the group (extended settings). Send an email to the group as a group moderator, but in the name of the group. This mail is held back for moderation which is unexpected. Expected: A mail sent by group moderator to a moderated group are not held back for moderation
    • blank page after login

      blank page after logging into my email account Thanks you
    • Introducing the revamped What's New page

      Hello everyone! We're happy to announce that Zoho Campaigns' What's New page has undergone a complete revamp. We've bid the old page adieu after a long time and have introduced a new, sleeker-looking page. Without further ado, let's dive into the main
    • Always display images from this sender – Is this feature available?

      In Zoho mail, I had my "Load external images" setting set to "Ask me", and that's fine. That's the setting I prefer. What's not fine though is I always need to tick "Display now" for each email I get, regardless if I've done that multiple times from several
    • Function #9: Copy attachments of Sales Order to Purchase Order on conversion

      This week, we have written a custom function that automatically copies the attachments uploaded for a sales order to the corresponding purchase order after you convert it. Here's how to configure it in your Zoho Books organization. Custom Function: Hit
    • Free webinar: Security that works: Building resilience for the AI-powered workforce

      Hello there, Did you know that more than 51% of organizations worldwide have experienced one or more security breaches, each costing over $1 million in losses or incident response? In today’s threat landscape, simply playing defense is no longer enough.
    • "Subject" or "Narration"in Customer Statement

      Dear Sir, While creating invoice, we are giving in "Subject" the purpose of invoice. For Example - "GST for the month of Aug 23", IT return FY 22-23", "Consultancy", Internal Audit for May 23". But this subject is not coming in Customer Statement. Only
    • Apply Vendor Credit Automatically

      Hello!!! Is there a way where in we can apply vendor credits automatically on the FIRST OUTSTANDING BILL of the vendor?? We have lots of VENDOR CREDITS ISSUES mostly!!! Applying it manually is a pain for us. Would be great if we have a way to apply the
    • Zoho Notebook Sync problem

      I'm facing a problem with syncing of notebook on android app. It's not syncing. Sometimes it syncs after a day or two.  I created some notes on web notebook but it's not syncing on mobile app. Please help!!!!
    • Next Page