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

      • Interbank transfers appear in Dashboard

        Hello. I notice that interbank transfers appear in both the incoming and outgoing part in the dashboard in ZohoBooks. This is not correct as it inflates both the incoming and outgoing, though the net effect offsets. Is there a way to avoid this?
      • Why Remove from Workflow is button is not working?

        Hey, I’ve got this contact that’s currently in an active workflow, but I’m having trouble removing it. When I check the workflow, click on that specific contact, and hit the "Remove from Workflow" button, nothing happens. Do you have any idea what might
      • Fixed Asset Manager items not on Balance Sheet report?

        Does the items added to the Fixed Asset Manager not pull in to report in the appropriate fixed asset categories on the Balance Sheet report? It seems only accumulated depreciation does (when run as accrual) but not fixed asset values.
      • Auto Charge Recurring Invoices on their due date vs issue date

        Requesting to auto charge recurring invoices on their due date. We are B2B and a lot of customers want terms net 30, 60 or 90 but want the convenience of auto pay and it's in our benefit as well. Is this something that could be implemented fairly quickly?
      • Commerce service

        If I am selling a service in Commerce, how do I turn off shipping?
      • Mobile App Location Features (Check-in, Maps) Not Working for Tasks Related to Deals (Address Data Copied via Function)

        Hello Zoho Community, I'm facing an issue with the Zoho CRM mobile app's location-based features (like check-in suggestions or map pins) specifically for Tasks related to Deals. Goal: I want the mobile app's location features to work for Tasks related
      • Not Able to access Api of Zoho Workdrive.

        I have Zoho One plan. And I am trying to use api of Zoho workdrive and Showing Invalid Client.
      • Schedule Zoho CRM reports only on Business Days

        Hello, Is it possible to schedule reports only on business days ? We currently get daily sales reports on weekend which has no value since the sales team doesn't work on weekends. Thanks
      • Creating task at someones date of birth

        Hi, I want to create a workflow which creates a task at someones date of birth. How can I do this?
      • How do I do a formula to join two fields together like first name and last name into full name?

        Having issues with this in my custom module.  In most CRM systems you would do: FIELD1 & " " & FIELD2 But it gives an error saying I'm not supposed to use double quotations so not sure what that means.  I've tried to read the formula help guide but it's
      • Zoho Support - Again!

        I've been using Zoho One for over 5 years and it seems the level of support just goes from bad to worse. The only thing that has kept me with them this long is the product itself. When something goes wrong, it is a mandatory 2 days wait for a response
      • Map Contact to Account record based on email domain

        Hi Community, I'm looking for a (presumably custom) solution to map Contact records to Accounts based on web domain. E.g. new Contact record John Smith with email john.smith@acme.com is automatically mapped to Account record Acme Ltd https://acme.com
      • Second Insight - Let's talk Layouts

        The Wheels of Ticketing - Desk Stories Let's talk Layouts What are layouts? Layouts refer to the arrangement or design of elements in a space, whether on a physical surface, like a room or a piece of furniture, or in digital contexts, such as web pages
      • Data Retention Policy Update – Effective May 1, 2025

        Starting May 1, 2025, we’re updating how long we store your landing page data based on your subscription plan. Here’s the new retention timeline: Trial Plan – 3 months Essentials Plan – 6 months Professional Plan – 9 months Enterprise & Bundle Plans –
      • Tip of the Week #52 – Use keyboard shortcuts!

        Tired of clicking around often? Navigating can feel slow when you’re switching between threads, views, or composing messages, all using just your mouse. Turn on Keyboard Shortcuts to move around your inboxes faster and work smarter. Once enabled, you
      • Random Email Missing for specific domians

        Our mail service randomly fails to receive emails. When certain domains proactively send emails, our sales team reports that they haven’t received those messages from clients. This creates a financial risk for us in certain cases. We’ve already submitted
      • CRM x WorkDrive : Intégration native de Zoho CRM avec Zoho WorkDrive

        Nous sommes heureux de vous annoncer le déploiement de l'intégration native de CRM avec WorkDrive ! La version initiale comprend les changements suivants : Il est désormais possible de connecter votre CRM org à un compte WorkDrive existant ou nouveau.
      • Making emails and notes private......

        Having experience using a plethora of CRM's I have noticed that this is one of the pitfalls of Zoho. Many notes and emails we want to add to Zoho we would like to make private or only visible to a set group of people.  The attached image from another CRM displays this feature.  While company policy at some firms could be that all information added to the CRM is public information.  This is a two way street.  Lots of companies have employees that are independent contractors in sales industries like
      • Two new updates to simplify your shift planning

        We’ve introduced two small but handy enhancements in Zoho Workerly that aim to reduce steps and give you more flexibility while planning shifts. Here’s what’s new and why it matters: Toggle between weekly and monthly roster views Pain point Planning shifts
      • Android and iOS Feature Updates

        The Zoho Desk mobile app (Android and iOS) provides agents with a platform to serve their customers from anywhere and at anytime. We are happy to introduce a few enhancements in the mobile apps that will support the users to be more productive and streamline
      • Agent form for car showroom

        Hey all! I am trying to make a useful crm form in creator for a car showroom. However, I am struggling with the best way to configure the CRM modules so I can make the form useable. They need to be able to have say a basic top level of is it a drop down
      • Multiple packages in one shipment

        Guys we have been asking for this for years. we want to be able to ship multiple packages for one customer in the same shipment, so as to avoid entering shipping info repeatedly, and avoid customer getting multiple tracking emails. When does this arise?
      • Changing Color Theme of Guided Conversations

        Hello, We have recently added Guided Conversations to one of our websites, but I am wondering if there is a way to customize the color scheme so it matches the appearance of the website? Thank you in advance!
      • Workdrive Android - how can I open a file in its native app?

        Hi, I'm testing Workdrive as a replacement for Onedrive. On a laptop/Windows this works fine. It syncs between devices and when I open a file, it opens the file in its native app. However, the Workdrive Android app seems to work differently. On a Android
      • Zoho SDK versioning and repositories need permanent naming/versioning changes moving forward

        I spent all day on this, a simple problem. Add a note to a lead, retrieve the notes from the lead. Finding samples and documentation is VERY difficult BECAUSE the versioning is totally non-standard. The php SDK doesn't follow SemVer. I suppose it may
      • Filter by technical IDs that should not be displayed

        Hello Zoho and Cumminity. I know I have already found similar requests elsewhere, but have not yet received a solution from Zoho. Therefore I would like to refresh the topic and hope that a solution can be found. I have reports in the Creator, which I
      • is Zoho desk down ?

        We have not received any tickets via email on the Zoho desk for the past hour. I also tried sending several test emails, but as of right now, no new ticket has been created on the desk.
      • How to make one code flow run for multiple people in the org

        Hi Folks, I have built a flow to transfer a Zoho calender event as Zoho CRM module record. The code works perfectly as needed. But the issue is I want the same functionality for others in our org. It is showing only my calendar in the selection trigger.
      • For security reasons your account has been blocked as you have exceeded the maximum number of requests per minute that can originate from one account.

        Hello Zoho Even if we open 10-15 windows in still we are getting our accounts locked with error " For security reasons your account has been blocked as you have exceeded the maximum number of requests per minute that can originate from one account. "
      • Subject: Urgent: Unrelated Email Automation Issue – Request for Immediate Resolution

        Dear Zoho One Support Team, We are currently facing a critical issue with email automation in our Zoho One account. Despite deleting the associated templates and workflows, the same email templates are still being sent to our customers. This has become
      • Tip of the week 63- Know your contacts well with polls in Zoho Campaigns

        Communication in its true form is characterised by feedback. In email campaigns there are a few avenues via which you can achieve this. Using polls in Zoho Campaigns is one such way. With polls enabled in campaigns, your contacts can interact with your emails and help you understand them well.     There are three types of polls available to be enabled in your email campaigns:   Basic poll Rating based poll Reaction based poll     Basic poll-    Provide a question and allow the email recipients to
      • Relocating from Zoho Connect External to Zoho Connect Internal or Zoho CommunitySpaces... or move off of Connect completely.

        This conversation is aimed at Zoho clients that currently use Zoho Connect's External network platform. As I discovered in the comment section of another post, Zoho Connect is halting development of Zoho Connect EXTERNAL networks in favor of the new Zoho
      • Relay Mail Failed

        Hello, We are using SMTP Relay Settings in ZOHO CRM for sending emails using office 365 server. But every time we are receiving below errors. The Relay Configuration for the domain Domain.com and feature WorkFlow has failed 3 times today . Mails will
      • Leverage layout rules to customize workflow

        Layout rules in Zoho Sprints primarily aim to customize the field layout of your creation forms to meet complex requirements. But it doesn't stop there. Its customization can push the boundaries of how your fields behave, how data is gathered, how processes
      • How can I see sent mail ?

        Hi, When you send a sale order or invoice to the customer using the email function, where can bee seen the sent email ? I can't find it in the "sent" folder of my mail client, nor I can't find it in the mail Related list under the company or the contact.
      • Add RTL (Right-to-Left) Text Direction Support Across All Zoho Learn Editing Interfaces

        Hi Zoho Learn Team, Hope you're doing well. We would like to request an important enhancement to Zoho Learn regarding support for right-to-left (RTL) languages such as Hebrew and Arabic. 🔹 Current Issue While the Knowledge Base Article editor provides
      • Zoho Creator Populate radio field with values with all the created rows subfor

        I have Main Form where i have a lookup field where i get brewery names and the number of tanks as a multiline text field with a list of beer names Based Brewery selected and bbt_tanks number i create rows in the subform and now i want to populate list
      • How to control the # of version of files to keep?

        Currently most of the WorkDrive Storage comprise of the many versions of files saved. How do I save some space and reduce the number of version of date or files saved in WorkDrive? Thanks
      • Meet Zoho Sign's AI answer bot!

        Hi, Our goal has always been to ensure all our resources are readily available for our users. With this in mind, we're excited to introduce Zoho Sign's answer bot, a solution designed to help users instantly find relevant help articles by eliminating
      • LinkedIn X-ray Search on Google

        Are there any workarounds or ways to extract mutliple Linkedin Profiles from a google Linkedin X-Ray search. My ideal would be copy the X-Ray search
      • Next Page