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.
![](https://desk.zoho.com:443/support/ImageDisplay?downloadType=uploadedFile&fileName=1719581951268.gif&blockId=edbsna4dac6aceea74a76d1167c10bed4fa9289f1487bcfae681e125c0d85bfe73c52&zgId=edbsn7709df772cce2825696f51e4f4f5fe02&mode=view)
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".
![](https://desk.zoho.com:443/support/ImageDisplay?downloadType=uploadedFile&fileName=1719581998348.png&blockId=edbsn3a552904a46637519c018124680d0a0af3643fcddca27f3f84bb2a2f9163f917&zgId=edbsn7709df772cce2825696f51e4f4f5fe02&mode=view)
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:-
![](https://desk.zoho.com:443/support/ImageDisplay?downloadType=uploadedFile&fileName=1719582230519.png&blockId=edbsn3a552904a46637519c018124680d0a0a515e0a2af3dce346e61bdb033543ff90&zgId=edbsn7709df772cce2825696f51e4f4f5fe02&mode=view)
![](https://desk.zoho.com:443/support/ImageDisplay?downloadType=uploadedFile&fileName=1719582252164.png&blockId=edbsnef45d1233818a6c20ce2d6dd644b39afc788088e7910f7187f3c34fc1d16f08f&zgId=edbsn7709df772cce2825696f51e4f4f5fe02&mode=view)
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 Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.