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

      • 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!
      • 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,
      • Create Funnel to Track Email Outreach Conversion

        Hello, We would like to create a funnel that measures: N° of emails sent -> N° of emails opened -> N° of emails responded We would like to measure this email response conversion rate for each of our SDRs. We use the analytics tool of Zoho CRM and not
      • Performance -> Extend Service -> Forms: How to use created form?

        So I have created a new Annual Evaluation form (cloned from the original one) and now I want to use it in an Appaisal cycle. QUESTION: How can I associate the form with the new Appraisal Template? Also, what is the difference between an Appraiser and
      • Zoho CRM - Rollup Field for "Total Calls TODAY"?

        Good afternoon, I'm trying to build a field that will track the total number of calls made to a lead in one day. This way i can organise my call queues by this to prioritise leads without an attempt. I can put in a Rollup field for *total* calls made
      • validation function for Stage QC means QC Done fileupload field not empty on Save

        validation function for Stage QC means QC Done field field not empty . if the fileupload has value also it showing the false statement on save how i fix this Also one more concern is Custom validation function work on blue print transaction. ///this is
      • Avalara Integration To Simplify Tax Calculations

        We are delighted to inform you that Zoho FSM now allows integration with Zoho Books accounts that have Avalara integration enabled in them. Designed for businesses operating across different regions and jurisdictions, Avalara ensures tax accuracy by factoring
      • Zoho Sign & Analytics

        Hi, Is it possible to import data from Sign into Analytics?
      • Transfer image url from Zoho Forms to Zoho Analytics

        I am storing an image in a zoho form. When I pull the data from the form into zoho analytics the image field does not import. How do I pull in the image url location or the image into Zoho Analytics.
      • Modules are continuously loading

        Hi! We are not able to open the task modules, it keeps continuously loading
      • Create multiple leads from a zoho form subform to populate inside zoho crm lead module

        I have corporate clients with numerous employees. When these clients complete our Zoho Form, they can nominate individual employees—providing details like first name, last name, email, mobile number, etc.—using a subform inside the zoho form. Is it possible
      • Unable to Retrieve refresh_token from Zoho Self-Client OAuth Flow

        Hello Zoho Support Team, I am currently integrating Zoho CRM with a custom Node.js backend using the Zoho OAuth 2.0 authorization process. I created a Self-Client from the Zoho API Console and generated an authorization code successfully. However, when
      • Tip: when "\r\n" not working for new-lines when building a file using the .toFile() function

        As above, ran into an issue - "\n" was working for newlines, but "\r\n" was not working for newlines and carriage returns. Took me a bit but using hexToText("0D0A") in place of "\r\n" resolved this. Including in the forums to save others any drama.
      • Multiple Pipelines

        Is it possible to create multiple candidate pipelines?
      • Showing meeting acceptances in CRM that originated from Outlook

        Hello Zoho Team, We send meeting invitations from Zoho CRM. Many of our recipients use Outlook and therefore use the RSVP buttons from Outlook to respond. They rarely, if ever, use the RSVP buttons from the Zoho invitation. Unfortunately, the meeting
      • Weekly Tips: Folder Sharing Simplified with Zoho Mail

        Let's say your team is working on a project that requires gathering numerous inputs via email. Your team lead, who manages the project, receives a flood of emails containing critical information. Instead of forwarding each email individually—which can
      • How to add a customized/dynamic Zoho Booking link in email footer?

        We just installed the latest version of the Zoho Desk <=> Zoho Booking extension from the marketplace and are quite happy to see the feature where a ticket-specific appointment booking link can be inserted in a reply. Is there any way to configure this
      • Power of Automation :: Design your Ideal Task form with Task Layout Rules.

        Hello Everyone, Use case:- One of our customers, who is managing their entire workflow in Zoho Projects wanted to dynamically display task fields based on the type of task being created. For instance, if a task falls under the "Shipment" category, only
      • Updating Zoho Multi-Select Lookup via Deluge Script

        I need to copy the ID of a lookup field (Match_with_IP) in the to the ID of a multi-select lookup field in the contact (Match_with_IP). I have the following script: record = zoho.crm.getRecordById("Contacts",ID); M_record = zoho.crm.searchRecords("Deals","(Matched_with_GC:equals:"
      • Now filter your records by multi-select pick list values from a dropdown with additional operators

        Hi everyone, Here's an update to help you elevate your filtering experience. You can now say goodbye to the cumbersome string values in filtering places for your multi-select picklist fields and say hello to a dropdown interface. It is now possible for
      • Log for Scheduled Reports

        Hello, Is there somewhere to view a log of the successful and/or failed delivery of Scheduled Reports? We have users who only receive them sporadically instead of at the scheduled intervals and I'd like to understand what causes the problem when it occurs.
      • 【Zoho CRM】BCCメール取り込みのアップデート

        ユーザーの皆さま、こんにちは。コミュニティチームの中野です。 今回は「Zoho CRM アップデート情報」の中から BCCメール取り込み用メールアドレスの認証についてご紹介します。 ・既存のBCCメール取り込み用のメールアドレスは、2025年5月15日までに認証する必要がございます。 BCCメール取り込みは、さまざまなメールアドレスから送信されたメールをZoho CRMのレコードと同期させる機能です。 BCCメール取り込み用のメールアドレスをBCCに追加するだけで、該当のメールがレコードと関連付けされます。
      • Expense Entry Error When Trying To Save (Related To Taxes)

        Hey folks, I've been trying to enter my first few expense entries in Zoho Books and I'm faced with the following error. "You cannot perform tax related operations when you are not registered for tax." But I have my HST/GST enabled and the tax rates are
      • Add timestamp when checkbox is checked in ZohoCRM

        I have two fields. One is a checkbox field called "Check", one is a formula field called "Date" in my ZohoCRM Leads Module. I want the formula field to AUTOMATICALLY populate with the date when I check the box next to it. Can this be done? 
      • Email Templates - Is There a Ticket Placeholder for Billing Entity ID

        Was looking to add Billing Entity ID as a placeholder in a ZoHo email template. https://help.zoho.com/portal/en/kb/desk/customization/templates/articles/creating-and-managing-email-templates#Guide_to_Placeholders e.g. the placeholder for Account would
      • Integration with Woocommerce

        Hi, Do you have plan to make integration with other e-commerce platforms, for example Woocommerce / Shopify / Magento ?  Thanks. 
      • Se puede mover un Cliente de un modulo a otro personalizado

        Hola, tengo una duda que me gustaría resolver: Actualmente trabajo con dos módulos: Seguimiento de Venta y Cierre de Ventas . Mi objetivo es que, cuando desde el módulo de Seguimiento se marca una venta como "Venta Efectiva" , el cliente sea movido al
      • Export Data & Attachments

        Hi, I am wondering whether it is possible to create an export of all data in creator, including attachments, for either backup purposes, or migration purposes. Thanks.
      • Zoho Desk: Q1 2025 | What's New

        Hello everyone, Our first release for the year 2025 is here! Check out the Release Notes for more details The diverse capability of AI and its avatars has been the center of attention lately, and we've made some significant strides in this area. We now
      • Feature Request Improve parent-child relationship visibility

        Hi team, The Parent-Child ticket feature is great, but I've struggled to see the relationship between tickets when using ticket list views. It would be a great quality of life enhancement for users if child tickets were nested under parent tickets in
      • need a third party to fix email authentication dns records

        at my wit's end - zoho began giving me spf, dmarc, dkim errors two weeks ago fussed with it since and now it seems dkim is the only problem and when i added the dkim record with the key from zoho mail it still wont work tired of this, need someone who
      • Add Button on Tickets

        is there a way I could add another button on the ticket aside of "closed ticket" only. Like I want to add another button "Send & Pending", "Pending for Response" like that.
      • Include Secondary Contacts (CCs) on Workflow Alerts

        Hi There, We use the Supervise Rules and Workflow Alerts to send automated messages to contacts in Zoho Desk. Most often, we are sending the ticket contact (our client) a reminder that we are waiting on their reply to our most recent message. The problem
      • Adding a lead by sending email message

        Hello, Our Zoho Mail is integrated with Zoho CRM (we have Enterprise) and we can add new leads to CRM right from the web interface/panel of Zoho Mail using buttons at the bottom right corner of the screen. This is very handy. We add leads on a regular
      • No Sales Returns on SO's with Dropped Shipped items + Inventory Items

        We have encountered an issue in Zoho related to sales orders that include both dropshipped items and inventory items. Specifically, it is currently not possible to create sales returns for the company’s own inventory items from these sales orders. This
      • ZMA v2 : Unable to delete a trigger from existing journey with several triggers

        I have multiple triggers on a single journey and need to delete one. However there isn't the function to do so, no delete icon or settings bar, no right click options of any kind. Every change I make affects all triggers ... How can I remove one of these
      • How to track the source of form submissions using referrer names in Zoho Forms?

        Ever wondered where your users are accessing your form links from? By tracking the origin of your form entries—whether it's from social media, email campaigns, direct links, or embedded on your website—you can identify which channels are driving the most
      • Snapchat

        Are there any plans to add Snapchat to Zoho Social or is there any API that we can use to integrate into Zoho.
      • Widget JS SDK to Upload a photo to a record in a Module

        Good day,  I would really appreciate it if someone can assist me. I have written a widget, to be used in a Custom Module in CRM.  My goal: I want to upload a photo from my computer and display it in die "upload image" field. I am using the JS SDK: https://help.zwidgets.com/help/v1.1/index.html
      • Zoho Creator Deluge - dynamically change fields depending on user input of field1 or field2

        Hi everyone and happy holidays! Hope that someone will help me figure out a solution to my problem… In my form there are currency, formulas and lookup fields. I’m well aware, that formulas fields if marked visible on form, cannot be hidden anywhere (like
      • Next Page