Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.



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

1 user likes this announcement.
6 Replies
Reply
  • 5 months ago

Followed the same steps. but it is not working. should paste the github code in the same function created for zbooks or should create a different function ?

  • 5 months ago

Hello

,

After setting up the "zbooks" connection, you need to create a new function and use the code from the GitHub link. Be sure to replace the API names of the custom fields in the script with the correct API names from your organization. To get the API name of a custom field, go to the custom field, scroll down, and you will find "API Field Name". Once you've created the function, associate it with a Workflow Rule to execute the function.

I hope this information helps. Feel free to contact our Support team at support[at]zohobooks[dot]com if you encounter any challenges or need assistance with the implementation. 

Regards,
Shireen Farhana
Zoho Cares

API Field Name.png
API Field Name.png51 KB
  • 5 months ago

Two significant issues we have encountered with the fine calculation function and its integration within the workflow of our system:

  1. Inaccurate Rate Adjustment: Currently, the function designed to calculate the total amount as rate + fine = total exhibits incorrect behavior. Specifically, when a fine is added, it causes the rate to increase as well. For example, with a base rate of 100 and a fine of 5, the expected total should be 105. However, the system displays an incorrect result of 105 + 5 = 105. This suggests that the fine is being incorrectly incorporated into the rate calculation rather than being added to it.

  2. Repetitive Fine Addition and Delay in Updates: The function is triggered through a workflow, which results in the fine being added each time the invoice is edited. For instance, if the invoice is edited a second time, the total amount becomes 110 + 5 = 110, causing cumulative errors. Additionally, there is a delay of several seconds before the total amount is updated, which impacts the efficiency of the system.

These issues undermine the accuracy and efficiency of our invoicing process, which is critical for business operations. We request an urgent review and correction of these problems to ensure that the fine is accurately calculated and added only once, and that the total amount updates promptly without redundant additions.

Thank you for your attention to this matter. We look forward to your prompt resolution of these issues.


  • 5 months ago

Hello
,

We need some additional information that will help us thoroughly review the issues and assist you with the appropriate resolutions. We have emailed you requesting the details. Please provide your responses, and we’ll take it from there.

Regards,
Shireen Farhana
Zoho Cares

  • 1 month ago

I am writing to express my deep dissatisfaction with the support I received from your team regarding this ticket I raised over eight months ago. At that time, I was informed that what I needed was not achievable in Zoho Books. Yet, this very article provides a solution for an exact replicate of my scenario using a custom function. 

 

This raises serious concerns: Why was I misled? I have endured months of unnecessary struggle, relying on Excel sheets to manage this issue, which has caused significant waste of my time and energy. Had I been provided with accurate information initially, I could have implemented the solution much earlier and avoided this frustration entirely.  

 

This level of service reflects poorly on your support team, as they failed to conduct a proper investigation before providing an answer. Such negligence is not only unprofessional but also unfair to your customers who trust your guidance.  

 

I request an explanation for this oversight and a commitment to improving your support processes to prevent such incidents in the future. I expect a prompt response and resolution to restore my trust in your service.


Hello Datageek, 

Thanks for posting on our forums.

With regards to your query, kindly note that multiple custom function requirements were received and successfully implemented in your Zoho Books organisation. However, there was a miscommunication related to this query and we regret for any inconveniences caused!

If you have any further queries, please reach out to us. Happy to help. 

Regards, 
Naveen Promoth D
Zoho Cares.

Reply to Shireen FarhanaA
/* */
  • 12
  • Insert
  • Plain text
Add Comment
(Up to 20 MB )