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

      • Subform data to Sheets

        I have been trying to setup a Zoho Flow automation to bring any Subform input to a Zoho Sheets but it seems impossible to post the subform entries to a Zoho Sheet. Is there any way to do it via Zoho Sheet API? https://www.zoho.com/sheet/help/api/v2/#CONTENT-Insert-row-with-JSON-data
      • Voiding of Invoice

        What's the implication in GSTR 1 and GSTR 3B when an invoice is voided?
      • Search WorkDrive File Contents from Creator

        Good afternoon, I am building out a Creator app where I want to allow users to input search terms from Creator that will return the appropriate files that contain those keywords from their Creator search. Is this possible?
      • execute workflow when a package is create

        hji, there is a wey to make a workflow when a package is sended o created ?
      • Adding string / text fields to modules

        I'm working on a custom leads module with a layout for call center agents.  I need to add text fields that are for display purposes only to prompt call center agents.  I haven't found any way to add a field in Zoho CRM that doesn't accept input, ie. is
      • BCC Dropbox on the Agency Module

        Good morning! We've recently implemented the BCC Dropbox feature on our Zoho CRM, but this only appears to be working on the Leads and Contractor (Contacts) modules. It would be incredibly useful for it to work on our Agency module too as a way of tracking
      • Display Company Logos in Pipeline View

        To improve deal management and enhance usability, we propose adding the option to display the associated company's logo directly in the pipeline view. Currently, users can only see the deal owner's avatar, but having the company's logo would make it easier
      • Data Model - CRM Adjusting size of Entity boxes

        (Sorry if duplicate, previous post seems to have disappeared.) I am viewing the Data Model for CRM, and while it is great to see such a model, there is an obstacle. Many of the entities show only a subset of their fields. The entity boxes have scrollbars
      • Symlinks not working

        Hi all - we're finding symlinks placed inside WorkDrive connecting to fodlers doesn't work. Anyone else seeing this?
      • Do "shortcuts" or symlinks exist in Workdrive?

        I need some kind of link or shortcut to put into folders that point back to original files or folders, is there any way in Workdrive to do this?
      • Quoted item subform setup button missing to add back unused field. (Zoho CRM professional edition)

        With Zoho CRM professional edition, understand that we couldnt further customize subform. But i notice there is no setup button for me to add back unused field that i accidentally removed (Tax field). it doesn't appear on left panel unused field as well.
      • Issue List Export

        When viewing all Tasks, there are options to filter the list and export. With the Issue list, I can filter, but not export the list. Is there somewhere else to go to get an exported list of filtered issues?
      • HTML formatting in task comments

        A few people have asked about using color-coding, bullet points, numbering, bolding, or italics in task comments. Is this a planned feature for the future?
      • Create and save user-specific filter views with Zoho Sheet

        The filters in Zoho Sheet have become even more collaboration-friendly. Previously, whenever you filtered any data, the filtered view will be updated for all the spreadsheet collaborators. This disturbed the data for others working on the same file. With this new update, you can apply data filters without altering the view for other collaborators in the file.   Collaborate with user specific filters   Let us say you are working on a sales report spreadsheet in real time with two remote colleagues. If
      • Unlock More Power with Zoho CRM's Enhanced Saved Filter Limit

        Dear Customers, We're happy to share some wonderful news for our valued users in the Enterprise and above editions of Zoho CRM. You must already be aware of the "saved filters" feature in Zoho CRM. Saved filters are custom search criteria that you can
      • 5名限定 課題解決型ワークショップイベント Zoho ワークアウト開催のお知らせ(4/24)

        ユーザーの皆さま、こんにちは。Zoho ユーザーコミュニティチームの藤澤です。 4月開催のZoho ワークアウトについてお知らせします。 今回は初めて渋谷にて「リアル開催」します!! ▷▷詳細はこちら:https://www.zohomeetups.com/Zoho20250424 ━━━━━━━━━━━━━━━━━━━━━━━━ Zoho ワークアウトとは? Zoho ユーザー同士で交流しながら、サービスに関する疑問や不明点の解消を目的とした「Zoho ワークアウト」を開催します。 Zoho サービスで完了させたい設定やカスタマイズ、環境の整備など……各自で決めた目標達成に向け、
      • An update to improve email delivery | Email Authentication & Relay

        Update Rollout Latest Update: Enterprise users (8th July, 2025) This update is now live for Enterprise plan users in all regions. This includes People Plus, but not Zoho One, which will be covered in an upcoming update. Professional users (31st May 2025)
      • Zoho Finance Limitations 2.0 #15: You can't filter any Sales Orders by their SubStatus in CRM or Analytics.

        All our sales orders move through various stages and it's nice when you can filter by open orders in "50% Building"  or "100% - Built" however this is not possible in CRM finance. It's a basic feature within native CRM using a picklist. My go to was Analytics,
      • Why ZOHO Function Can't Read Custom Field API In Quotes Module (Subform)

        I’m using a Deluge function to transfer data from a subform in the Quotes module to a subform in the Accounts module. Everything works except for a custom picklist field in Quotes—no matter what I try, the Zoho API can’t read that field ("Status_sb").
      • 10 workflows automatisés pour booster votre conversion

        Le parcours client n’est plus une ligne droite. Aujourd’hui, les acheteurs prennent le contrôle : ils explorent les réseaux sociaux, consultent des avis, visitent des sites web et interagissent directement avec les marques. Ils ne se contentent plus d’écouter
      • How to Update custom Fillable Fields via Zoho Contracts API

        Our requirements for populating contract from CRM requires passing values form multiple record types (Deals and itemised Related Lists, Proposals etc). The Contract extension for CRM is great, but these do seem to be beyond it's design or capability.
      • Leave request for 0 hours is registed as 24 hours

        I have configured workschedules for all my employees, so the leave request for them whould be a lot easier. In that spirit I have configured a shift from 9 to 9 with a total duration of 0 hours. When a employee fills in a leave request for lets say a
      • Seeking Business/Operations Analyst with Strong Zoho Creator Skills

        Job Title: Business/Operations Analyst-Zoho Creator Specialist Location: Kansas City, MO (On-site) Company: SkyMark Refuelers About Us: SkyMark Refuelers is a leading manufacturer based in Kansas City, known for delivering high-quality aviation fueling
      • Limit POP Downloads to Inbox?

        Hello, When I connect to and download email from my account using the POP3 protocol, it appears that it's also downloading email from my Sent mailbox. Is there any way to limit the POP downloads to Inbox emails only? Thanks!
      • Recurring Events Not Disappearing from Zoho Calendar When Canceled by Organizer

        I receive a recurring meeting invitation to my Gmail address, The event correctly appears in my Zoho Calendar, since I have Gmail calendar integrated/viewable via Zoho Mail. When the organizer cancels one occurrence, the canceled meeting does not disappear
      • How Can I change admin account Email?

        Hi, I want to change admin email address for my account (I'm using Zoho Mail). How can i do this? Thanks!
      • Can't remove old phone number from Zoho email account and add a new one?

        Every time I try to add my new number it supposedly sends me a code which I never get and I still don't know how to remove the old number.
      • Many Deals to one Contact - Syncing issue

        Hi, In our CRM we have multiple deals to a contact. We have a field in deals called "Contract Type" - sometimes they are "business" and sometimes they are "personal" deals. I want to be able to send different emails to contacts depending on this field.
      • How to integrate single-sign-on using Linkedin in Zoho Creator

        How to integrate single-sign-on using LinkedIn in Zoho Creator need step by step integration.
      • What’s New in Zoho Expense: January - March 2025

        Hello users, We're excited to bring you the latest updates and improvements we've made to make your travel and expense management smoother and more effortless. Let's take a quick look at the important updates we've rolled-out in Zoho Expense between January
      • Ask the Experts 19: Live Expert Panel Discussion - Inside Zoho Desk Spring Release 2025

        Hello again! Have you ever needed quick insights into key indicators to help manage and streamline specific operations? Have you started using AI to enhance your customer service in Zoho Desk? From configuring simple bots using Guided Conversations to
      • Permissions on Views

        Having the option of any agent creating custom views is firing back and got a situation where there are a hundred different views across the team and tickets are not being dealt in the most efficient of ways.  Tickets seems to be missed by some agents, whislt others have customized their columns in a way that due dates are not visible and not being respected. There needs to be control on this function in order to have a standard set of views and the ability to prevent users from performing customizations
      • Repeating Images in Emails

        Some emails have images that are repeated when viewed both on the web client (mail.zoho.com) and when using the Zoho Mail android app. It looks like perhaps some of the email styling is being ignored or applied incorrectly, as a brief inspection of the
      • How to change the default module A"leads" to customised module "abc" in Zoho while integrating the leads from Skrapp!

        How to change the default module A"leads" to customised module "abc" in Zoho while integrating the leads from Skrapp!
      • 554 5.2.3 MailPolicy violation Error, help?

        This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. 554 5.2.3 MailPolicy violation Error delivering to mailboxes I am not sure why i am getting this, please
      • Por que utilizar o Zoho Creator 6?

        No cenário atual, as empresas enfrentam o desafio constante de adaptar seus processos com agilidade e eficiência. É aí que entra o Zoho Creator 6, a mais recente versão da poderosa plataforma low-code da Zoho — e no nosso novo vídeo, mostramos exatamente
      • Currency Field Does Not show commas upon entry - leading to inaccurate entries!

        Hello Zoho.. When our sales reps are entering deals and the profit/revenue it is difficult to accurately enter numbers with lots of zeros when there commas are NOT added until the record is saved. Could commas be added to this filed type as it is being
      • m2 is converted to Kader when switching from Dutch to English

        By default, our company works in Dutch. We sell a lot of products with m2 as a unit. Now we've noticed that if we change the language in Zoho to English, the usage unit 'm2' gets replaced by 'Kader'. We've got no idea why. I'd expect that the translation
      • E-Invoicing Automation

        Do you have an API endpoint for pushing the invoice through the e-tims for Kenya
      • Easy way to create task from call

        In Bigin I would like to have easy way of creating the tast directly from the call. Now after the call I need to enter company record and create task there. There must be some easier and more user friendly way to create new task after the call!
      • Next Page