Function 58: Custom calculation in item table of invoices (2 fields)

Function 58: Custom calculation in item table of invoices (2 fields)



Hello everyone, and welcome back to our series!

In Zoho Books, the Item Amount in invoices is calculated by multiplying the Quantity and Rate fields. Previously, we shared a function to include a custom field in this calculation.  Today, we are taking it a step further to make it even more versatile for various business needs. Instead of just one custom field, you can include two custom fields to determine the Item Amount.

Item Amount = Custom Field 1 × Custom Field 2 × Rate × Quantity

Consider Mr. John Hector, who runs a steel production plant. He processes orders for steel sheets according to their dimensions. For accurate billing, he can utilize today's function. When creating the invoice, John can enter the length and width of each steel sheet into the custom fields and specify the number of sheets ordered, and the rate per square foot in the default fields. The function will automatically calculate the Item Amount using this formula:

Item Amount = Length × Width × Quantity × Rate



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. Create the third (Length) and fourth (Width) variables as item-level custom fields (Decimal type) to be displayed in the sales transactions.



3. Similarly, create another custom field called " Unit Rate" to be displayed in the item table. The purpose of this custom field is to store the original sales rate of the line item. 



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.

Here's how the function will work:

The custom function will be executed once the invoice is saved. Initially, it copies the original sales rate to the Unit Rate (Custom) field. Then, it multiplies Length × Width × Unit Rate and populates the result in the Rate (Default) field. Following this, Zoho Books calculates Rate (Default field) × Quantity and fills the result in the Amount field.

Note: If you wish to hide the "Rate" - default field at the template level, go to Settings > Customisation > PDF Templates > Invoices > Edit > Table > Disable the checkbox for Rate field > Save. Now, the Custom Field 1 (Length), Custom Field 2 (Width), Unit Rate (Custom Field), Quantity and the Amount field will be displayed on the invoices.



If you have to incorporate two extra values into your Item Amount calculation, this function is perfect for you. For further customization or assistance, please reach out to our Support team at support[at]zohobooks[dot]com. We're here to help!

Regards,
Shireen Farhana
Zoho Cares

    Nederlandse Hulpbronnen


      • Recent Topics

      • Multiple Tabs in the Dashboard

        Hi team, Can we enable an option to add multiple tabs in a dashboard? This will help to group the content to be displayed to employees and make it more usable and user-friendly intranet space.
      • Function #6: Calculate Commissions for paid invoices

        Zoho Books helps you automate the process of calculating and recording commissions paid to sales persons using custom functions. We've written a script that computes the commission amount based on the percentage of commission you enter and creates an
      • IMAP as a source option in Dashboards

        Hi Team Can I request IMAP be added as a source option for running a report or creating a KPI in dashboards. I have selected all options and my IMAP linked emails are not showing, I can only check these by going to emails in a contact. Thankyou Josh
      • Canvas responsive preview in different browser window causes re-authentication/verification

        I'm trying to design a view in Canvas. I am testing in a tab with a desktop view, and another tab (on my same desktop/IP) with a responsive view of an iphone. Every time I refresh, it boots me out of the previously used tab. If I forget to refresh the
      • Can I add external account to Zoho PageSense?

        Hello, I would like to ask you about adding external users to projects in Zoho Pagesense. I can add only users from my organization. Is any solution for adding as we have in The Zoho Projects clients accounts?
      • Import subform entries conveniently in CRM

        Dear All,   Subforms have always been crucial for associating additional data with CRM records. You can easily associate line items with parent records and keep track of various details related to your records. We're pleased to announce that we've introduced
      • Cómo convencer a tu manager para venir a Zoholics 2025

        ¿No estás seguro de si a tu manager le convence que asistas a Zoholics 2025? ¡No te preocupes! Aquí te damos algunos argumentos clave que te ayudarán a convencer a tu manager de que participar en este evento es una inversión tanto para ti como para la
      • HTML Email in Zoho Books

        Is it possible to create custom html email template in zoho books. 
      • Can you change the width of a template, and/or the size of images we upload to the template?

        my images look good in preview, but are then skewed when sending email. Also, are image sizes "fixed" by which template is being used? Thanks in advance. CV
      • Tip of the Week #53 – Use Zia writing assistant !

        Ever find yourself typing out a quick reply or discussing something with your teammates, and a tiny typo slips through? Or maybe you’re aiming to refine your writing for better clarity and context? That’s where Zia steps in , Zoho's AI powered writing
      • Sheet View for Reports

        Hi - is there any plan to make a "Sheet View" function for reports??? It would be a huge improvement. Moderation Update (30th April 2025): We have a separate post discussing the same requirement. Please follow the below post to stay updated on the progress.
      • When adding or editing a contact in contact tab, the contact or edits cannot be seen in mail tab for up to 24 hours

        When reporting this as a bug, I was informed that it can take up to 24 hours for a newly added or edited contact in the Contacts section to become usable in the Email tab—whether through autocomplete or when selecting recipients via the To button. Frankly,
      • Power of Automation :: SLA for Projects

        Hello Everyone, In this post, we would like to highlight the feature "Time-Based Workflow Rules for Projects" Workflow rules help project managers organize tasks in a project by setting criteria and actions that meet the project requirements. Zoho Projects
      • RouteIQ for Zoho FSM

        Beste, Zou wel top zijn dat we een RouteIQ hebben voor FSM aangezien we constant moeten zien wat de beste route is voor onze monteurs. Nu moeten we een speciale aparte programma hebben om de beste route te berrekenen voor onze monteurs aangezien de planning
      • Let's Talk Recruit: An approval process with zero follow-ups

        Welcome back to our Let's Talk Recruit series! Today, the topic of discussion is the Approval process. We’ll discuss how approval workflows function in recruitment, explore real-world use cases, and show how automation in Zoho Recruit can streamline approvals
      • Block certain emails from creating tickets

        Hi there! We get a lot of tickets into Zoho desk from people emailing our support email that feeds into Zoho. We have created some 3rd party accounts using our support email and we get notification emails from these accounts. These emails create tickets.
      • Customer Statement Templates

        Hi  In know that Credit Note Templates have already been proposed but I would also like to see Customer Statement templates as well please. Thanks Gene
      • Where to find org ID and department ID?

        Hi there All the existing info on this seems to be incorrect or out of date. It's not in my URL, it's not in the developer space > APIs anymore like was suggested in some other forum posts. How do I find it?
      • Turn off Knowlege Base Follow options and Follower lists

        Is there a way to hide or turn off the option in the Knowledge Base for users to follow specific departments/categories/sections/articles? If not, is there a way to turn off the public list of followers for each of those things? Otherwise, customer names
      • Zoho desk not sending call reference to user

        Hi, I am using zohone desk and have setup the call logging email address but sadly users are not getting a call reference notifying them that the call has been logged also can't see the updated call when it is going through faces. My question is, is there
      • Display CRM account field on Zoho Desk Ticket

        I have linked a custom CRM Account field for "Customer Care Lead Advisor" with Zoho Desk Accounts. I know the data has synced correctly as I am using this field for some automations based on this lead advisor field. When viewing a ticket that is linked
      • What is the difference between a template and a snippiet

        Hi there, I am currently working on optimising our service desk and improving the consistency of our responses. I have come across two tools that appear to help do this, templates and snippets. I was wondering what the similarities and differences are
      • Is there a way to set up templates for commonly occurring issues on Zoho Desk

        Hi there, We have recently migrated our service desk over to Zoho. I was wondering if there is a way we can set up custom templates for specific requests that we commonly get from our customers. Example: Customer often requests a password reset. There
      • Missing "Created_Time" Field in Zoho CRM API Search Results

        Hello, I've noticed that the "Created Time" field is visible in the Zoho Canvas view for my Accounts Module. However, I'm unable to retrieve this field's value via the Zoho CRM API. Specifically, when using the /search endpoint for the Accounts module,
      • Problem connecting social accounts and file upload

        I have two brands that I manage in Zoho, each with their own social profiles. I didn't have any issues for the first few months, but recently the Instagram for one got disconnected and no matter what I've tried, it won't reconnect. If I go into the settings
      • Marketing Automation Emails Going to Spam

        Google is trapping all the marketing automation emails in spam. My domain has a perfect reputation and it looks like Zoho has a low reputation which is sending it to spam. When I pull the email out of spam and click on a link in the email, I get this
      • Invalid OAuth Token When Using Zoho CRM API with Postman

        We're in the process of integrating Zoho CRM with our Django backend and currently testing the API endpoints via Postman. I've forked Zoho's official CRM REST API collection in Postman for this. Steps Taken: Created a Self Client via Zoho API Console:
      • Device Credentials

        Connection Credentials for my device. Where is this displayed in the application.
      • is there a better way to routinely export my project timesheets?

        Hi there, I am somewhat happy with how Zoho books handles time.  One thing that is missing is more user driven control over my data.  I have a workflow where I constantly need to give customers feeds of work done.  So I pick a project, and would ideally
      • Zoho Flow - Create CRM Meeting - Expected input type is jsonobject

        I'm trying to use the Create Module Entry action in Zoho Flow to create a meeting in Zoho CRM. The participant field is throwing an error during debugging: "Zoho CRM says "Invalid input for invalid data. The expected input type is jsonobject." I've tried
      • Assistance Required for Fetching Custom Subform Data in Zoho CRM Widget

        Hi Team, I am facing an issue with my Zoho CRM Widget. In the Quotes module, there are two Subforms — one is a predefined Subform, and the other is a custom Subform that we have created. In the Inspect console of my widget, I am only able to see the predefined
      • Introducing Zoho Projects Plus!

        Just as each project you execute is unique, so is the project management requirement. Following a one-size-fits-all approach to managing your projects might limit the possibilities of exploration and advancement for your teams. Acknowledging this, project
      • Zoho Mail Shared Mailbox migration

        Hello! I am in the process of migrating our whole email infrastructure to Zoho Mail. We currently use cPanel for our email accounts and we want to migrate them to Zoho Mail using the migration tool. The problem is that we use an email for our sales department
      • Have an input card for zobot that could collect Name, Email, and Phone or a message all at once

        It would be great to have an input card for the codeless bot in a form style that allows it to ask all relevant questions at once. at any point in the chat flow or conversation, This approach would simplify the interaction, making it easier and more straightforward
      • Change DKIM From 20248 Bit Key to 1024 Bit Key

        I am having issues trying to change the Bit Key in DKIM from 2048 to 1024 so that it works with my Shopify Account. I can only find information on how to configure this when the Domain Key is added, but I couldn't find any details on how to change it
      • Update Date field using a custom function

        Hello, In Zoho FSM, Equipments module, I created the following custome fields for tracking the calibration of the eqipments: "Calibration Required"; type: Checkbox; API Name: "Calibration_Required__C" "Calibration Interval (Days)"; type: Number; API Name:
      • Zoho CRM API, Python SDK v7 Quoted_Items

        Hello. How do I use this SDK to retrieve the Quoted_Items from a Quote and downstream the items in a Sales Order I can see references to a constant INVENTORY_MODULES_ITEMS = ["invoiced_items", "quoted_items", "purchase_items", "ordered_items"] But I cannot
      • Zohoのシステムについて

        ここで提供しているofficeソフトが使いたくて質問するためにユーザー登録をしました。企業を対象として事業展開されているようですがzohoのシステムがよくわかりません。writerやsheetなどのソフトを利用してもかまいませんか?また利用するときの費用はどうなっているのかとか組み込まれているbasicについての資料とか、要望事項を記してくださいと書かれてあったりとか質問したいことがたくさんありますがこうした質問が許されているのかもわかりません」 ここの書き方もよくわかりません
      • Email de outra pessoa ja associada ao meu dominio

        Tenho um dominio e está falando que o email da pessoa ja está associada ao meu dominio
      • On create of Amc module get sub form data of last row and update in Schedule Vist End Date field in zoho crm

        @Iswarya B G @Bhoomi Joshi @Abinaya Praveen @Ishwarya SG @Haiku Technical Support On create of Amc module get sub form data of last row and update in normal module field Schedule Vist End Date field in zoho crm
      • Next Page