Function #57: Automatically group items in invoices based on categories

Function #57: Automatically group items in invoices based on categories



Hello everyone, and welcome back to our series!

As a business expands and new product lines are launched, it becomes important to organize the items for better inventory management. The Category field in Zoho Books helps here by allowing you to add and assign categories to group items effectively. You can even create sub-categories under a parent category for more specific organization. The Sales By Category report provides insights into the performance of each category, helping you make informed business decisions. Today's function revolves around this Category field. It aims to automatically sort items added to an invoice based on their categories and display the category names as headers. 



Consider Mr. John Hector, who runs a wholesale stationery shop. When a customer orders various items such as pens, paints, paint brushes, color palettes, and desk supplies from different categories, John raises an invoice in Zoho Books to record the sale. Once the invoice is saved, the custom function is executed to organize the items by their categories and add the category names as headers. For example, items related to art—like paints, paint brushes, and color palettes—are grouped under "Art Supplies." Similarly, other items will be grouped under their respective category headers, and any uncategorized items will be listed under the header "Others". This organized layout helps both John and his customers easily understand the assortment of items on the invoice. 



Note: The Category field will be accessible in Zoho Books after enabling the Zoho Inventory add-ons

Prerequisites:
 
1. Create a Connection named "zbooks" to successfully execute the function. You can watch the GIF attached below to know how to create the connection.



2. To enable the "Category" field, go to Zoho Books > Items > Field Customization > Hover over the Category field > Click on the dropdown menu and select "Mark as Active".



Custom Function:

Navigate to Settings -> Automation -> Workflow Actions -> Custom Functions -> +New Custom Function > Add the function code from this GitHub link -> Save. 

Workflow Rule:

Go to Settings -> Automation -> Workflow Rules -> +New Workflow Rule and set up the workflow rule as shown below:-





In the final step of this workflow rule, associate the custom function you created and then hit Save.

If you need assistance with implementing this function, please contact our Support team at
support[at]zohobooks[dot]com. We are happy to help.

Regards,
Shireen Farhana
Zoho Books 

    Zoho Campaigns Resources


      • Desk Community Learning Series


      • Digest


      • Functions


      • Meetups


      • Kbase


      • Resources


      • Glossary


      • Desk Marketplace


      • MVP Corner


      • Word of the Day


      • Ask the Experts


        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 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 コンテンツ






                              ご検討中の方

                                • Recent Topics

                                • Clarification on Lead Score Breakdown in Zoho Marketing Automation

                                  Hello I have a question regarding the lead scoring system in Zoho Marketing Automation. Specifically, I want to understand the breakdown of how a lead's score is accumulated. For instance, if Person A has a lead score of 50, I would like to see the detailed
                                • How can I disable Zoho Business chat from spamming Chrome's console logs?

                                  I don't want Zoho logging to console. Here's what it's logging: STOP! vendor.bd5618bc1416dabeac98_.js:45 This is a browser feature intended for developers. Do not enter or paste code which you don't understand. It may allow attackers to steal your information
                                • Ability to Initiate WhatsApp Template Messages in Zoho SalesIQ Without Preexisting Chat

                                  Hi Zoho SalesIQ Team, I hope you're doing well. I understand that with the WhatsApp integration in SalesIQ, clients can contact us via WhatsApp, and we can use WhatsApp templates to send messages outside of the 24-hour window by reopening an existing
                                • Delay Function

                                  Hello, I would like to emphasize the importance of incorporating a delay functionality within custom functions, particularly in the context of integrating multiple platforms. As I understand, a delay function is not available by default in Zoho. However,
                                • Access Multiple CRM Accounts With Single Sign-on

                                  Hello everyone, We are happy to announce that Zoho CRM now provides multi-organization support. What is multi-org support? In order to ease login and access to multiple Zoho CRM accounts, we came up with multi-org that allows users to use same email address
                                • Bad change: Zoho Notebook Android app requiring Google Play Store login

                                  I have been a Zoho user for a decade or so, and a One subscriber for several years. There are always areas for improvement, but on the whole, I've been quite happy with it. A big part of my choice to go wtih Zoho is that I value data privacy, and try
                                • SalesIQ Channel Icons for Ease of Reference

                                  Hi, team! It would be neat if on the mobile SalesIQ app, similar to its web counterpart, we could see the unobtrusive icons for social media channels for all chats. Now that I have multiple such channels (so cool!), it helps visually separate them, seeing
                                • Option to Re-order from past orders

                                  Customers would like to place a repeat order with the business entity. Currently there is no option to support this and everytime the customer has to check out following the same process. Can a option be given to reorder from the past orders?
                                • How to configure Zoho for multiple email addresses, on multiple domains, so all mail is received in a single Zoho paid account

                                  I have four email domains and each of those domains has one or more email addresses. I want to point any received mail from all four of the domains, for all users, to a single mailbox, and if possible to only subscribe to that one mailbox. How would I
                                • can not receive or send email through POP

                                  Hello, I have not been able to receive or send email over POP from my zoho account since the Jan 29. New email is still visible through the web view, the POP shows ssl error code 5, it is wired that I have not made any changes with my POP settings, the
                                • we can assign ticket to offline users

                                  we can assign ticket to offline users
                                • Menu Bar

                                  Hi, Please guide how to change menu bar from vertical to horizontal
                                • Sort table using GROUP BY.

                                  Hello guys usually I sort a table with sort option and it works fine. But for my need I use GROUP BY feature and I try to sort my table by GROUP BY and inside the GROUP BY to sort on specific column. It seems that the option to sort TABLE is disable when
                                • Problem (again) with Answer bot card in Zobot

                                  Hello, I'm building the Zobot for my company and I meet some issues using the Answer bot card. The main one is that even if the question is clear and related with a FAQ or an Article, the chat bot doesn't recognize the question and can not answer. This
                                • Zoho Books | Product Updates | January 2025

                                  Hello users, Now that January is over, here are some exciting updates to make this new year even better. We’re back with new features and enhancements in Zoho Books, including comparing fields as criteria in workflow rules and a custom SMTP integration.
                                • Leistungsdatum in Rechnungen (Zoho Books)

                                  Hallo, ist es irgendwie möglich den Leistungszeitraum in der Rechnung aufzuführen? Beste Grüße Aleks
                                • Introducing the New SalesIQ Live Chat Widget: Twice as Fast, Fully Optimized for Engagement!

                                  Hello everyone! To celebrate our 10-year milestone, we're thrilled to unveil the new and improved SalesIQ Live Chat Widget! Redesigned at both the User Interface and performance levels, this enhanced widget is not only optimized but also 2X faster than
                                • Generate a Zoho Sign link

                                  From time to time I get a response "I never received your you e-document for electronic signature" is there a way to generate a Zoho Sign link to share.
                                • Client Script | Update - Introducing Subform Events and Actions

                                  Are you making the most of your subforms in Zoho CRM? Do you wish you could automate subform interactions and enhance user experience effortlessly? What if you had Client APIs and events specifically designed for subforms? We are thrilled to introduce
                                • I cant recieve emails help

                                  my email address is support@rootify.in
                                • Candidate Registration/Invitation

                                  It would be great to include the 'invite' candidate functionality into some of the automation functions - ether through a custom function trigger or webhook or accessible through an email template.  Currently there is no way to add this functionality into any workflows or blueprint steps which, I find limits the ability to invite candidates to engage with us directly through our candidate portal. 
                                • A decade together - Thank you for being a part of the journey with Zoho Social!

                                  A decade ago, we started Zoho Social with a simple vision: to make social media management easier, smarter, and more impactful for your business. What started as a small idea has grown to a powerful platform to help businesses across the globe reach their
                                • Doesn't Catch Duplicate Accounts

                                  Zoho is very bad at catching duplicate accounts. If we have an account in Zoho, and we import the same account but with "Inc." or "LLC", it doesn't catch it, it just duplicates it. When importing from another app (like ZoomInfo) I set it to catch duplicates
                                • Exciting News: WhatsApp Templates is now available on Zoho SalesIQ!

                                  We are excited to announce the launch of WhatsApp Templates on SalesIQ, a highly awaited feature that will take your business messaging game to an all-new level. This is going to help you enhance your communication patterns, while also allowing you to
                                • Set Custom Icon for Custom Modules in new Zoho CRM UI

                                • Getting daily summary report from SalesIQ

                                  Why am I suddenly getting a daily summary report from SalesIQ when I'm not even using it nor signed up to it knowingly?
                                • Building a form with Categories and multiple sub-categories

                                  Hello, I am completely new to Zoho and the Deluge programming language. I would like to build an easy way to lookup a set of previous orders from my order tracking sheet. What I have done so far is import my Excel order list into Zoho so it shows all
                                • How to design a big system diagram?

                                  Hey, we are implementing a huge CRM system including all our departments into the CRM, just like the new UI "CRM for everyone" motivates to do. We used Draw.io to predesign everything inside of a diagram. Something like blueprints, modules, custom fields,
                                • How do I check when a date field in Zoho Projects has been changed from a flow?

                                  I am trying to create events in a shared Outlook calendar based on a custom date field in Zoho Projects. And I have a trigger to create the event with the date from this field when the project is created. But if this date changes in Zoho Projects, I need
                                • Pivot Chart - Zoho Creator

                                  In Zoho Creator, I want to enable an edit option within the Pivot Chart itself. Additionally, I want to avoid showing duplicated values for certain columns. For example, I’ve created a month-wise sales report for each product type. The form contains fields
                                • Subform Zoho Form to Creator

                                  Hi, I would like to be able to retrieve the values of a Zoho Form subform to create an entry for each in Zoho Creator. To send from Form to Creator, I use Zoho Flow. I have a custom function, which should normally retrieve each field value then create
                                • Lead Blueprint transition in custom list view

                                  Hi, Is It possible to insert the Blueprint transition label in a custom Canvas list view? I am using Lead module. I see the status, but it would be great if our users could execute the Blueprint right from the list view without having to enter the detailed
                                • Zoho Analytics - Level on level queries

                                  I am facing a limitation of having too many level on level queries however some of my queries are complex and rely on multiple joins to get my desired output. How can I bypass this limitation as this is hindering my report creation.
                                • Spreading Love, One Ticket at a Time

                                  At Zylker Techfix, customer service wasn't just about solving issues, it was about creating meaningful human connections. The team believed that every interaction was an opportunity to understand their customers better and offer solutions that truly made
                                • Can you increase/decrease the font-size of all messages?

                                  The size of text for all the messages I get are too big. I want to know if I have control over this?
                                • Zoho Sign Custom Domain

                                  Any plans for Custom Domain?
                                • Customer members area

                                  Does FSM support a customer members area? If not what do you propose we use if we want the data used in FSM for customers to give them an area / login to see past orders, create new orders and general announcements.
                                • Zoho Creator Get Records Integration Task

                                  Trying to use Zoho Creator's Get Records integration task to fetch records from a specified report in Zoho Creator: https://www.zoho.com/deluge/help/creator/get-records.html However, I continue to receive a code 2894 error saying that the report is not
                                • Where can I transalte Next/Prev button in Card mode?

                                  Hi, I can't find a way to translate Next/Prev button in my form displayed in Card mode. I know it is possible to do that in standard form but how to do that in the card mode? Best regards Pawel
                                • For Log a Call, "Call Type" menu needs more options, like "Left a message" and "Received a message".

                                  When logging phone calls, the "Call Type" menu is locked and only has 3 choices. Outbound, Inbound, and Missed. Since it is not limited to only IN or OUT, then it should have more useful options other than only "Missed". It is a locked system field. It
                                • Next Page