Function #34: Automatically add a free item to the invoice based on the purchase amount

Function #34: Automatically add a free item to the invoice based on the purchase amount



Hello, everyone! Welcome back to our series.

It's the holiday season, marking a time when businesses witness increased demand for products and services, leading to a significant boost in sales. This also presents an opportunity for businesses to engage with their customers. As a gesture of appreciation and gratitude, many businesses opt to include complimentary items with customer purchases to enhance the overall shopping experience. Today, we bring you a custom function that automatically adds a complimentary/free item to the invoice based on the total purchase amount. 

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. The items that will be given as free should exist under the Items module in Zoho Books.

3. To determine both when and what item should be given as complimentary, define distinct rate slabs in the script and assign a corresponding free item to each slab. In today's script, we have pre-defined 3 rate slabs.
If the invoice total is between $100 - $499, it is eligible for the free item A.
If the invoice total is between $500 - $999, it is eligible for the free item B.
If the invoice total is more than $1000, it is eligible for the free item C.

4. Create a Check Box-type custom field by the name "Include Free item?" for Invoices. Only when this field is ticked, the function will be executed to check the applicable rate slab.



Custom Function:

Navigate to Settings -> Automation -> Workflow Actions -> Custom Functions -> +New Custom Function > Add the function code from this GitHub link

Note: The custom function will be executed after the invoice is saved. 

Workflow Rule: 
 
Go to Settings -> Automation -> Workflow Rules -> +New Workflow Rule and set up the workflow rule as shown below:-






Here's how it works:

After creating ("Include Free item?" should be True) and saving an invoice, the custom function kicks in, checking the rate slab associated with the invoice. Based on the identified rate slab, the function automatically adds the corresponding free item. 

Try out this function and drop your feedback in the comments section. If you have any specific customizations in mind, don't hesitate to reach out to our support desk at support[at]zohobooks[dot]com. We're here to assist you.

Stay tuned for our next custom function. Until then, have a joyful holiday season!

Regards,
Shireen Farhana
Zoho Books

    • Recent Topics

    • Introducing Assessment-based Filters in Zoho Recruit

      We're thrilled to announce a handy new feature: Filtering Candidates by Assessment Answers. This tool allows you to refine your candidate search based on their performance in screening tests or assessments. It's a great way to find candidates who meet
    • Error sending an email

      Hi, I'm trying to send an automated email (receiver is always the same) via Deluge function. It was working perfectly, but yesterday the receiver's mailbox got full and started returning this error: { "data": [ { "code": "NOT_ALLOWED", "details": { "reason":
    • the original LEAD STATUS picklist with “open”, “not qualified” and “junk” vs. own pick list

      hello, I have built a blueprint for lead processing, but used a separate “lead status field” for this. Now I have noticed that the zoho original “lead status” field in the pick list properties still has “open” and “not qualified” and “junk” as status.
    • Email signature duplicate

      Hi, For a few weeks, opening the email writer would show an error. After clicking ok, the signature would change slighty (font size, I believe). After that it worked fine, so we thought nothing of it. However, now it no longer shows the error puts the
    • emails to AOL / Yahoo bouncing

      When I send email to an AOL account this morning, I receive the following error: -------------------------------------------------------------------------------------------------------------------------------------------------- This message was created
    • New Agent Creation - Not Receiving Activation Email

      I created multiple new agents within Zoho Desk with no issue. Everyone one of them received the activation email except one. The email is correct and confirmed multiple times. It is not located in the Spam folder. I withdrew the activation and recreated
    • Can I access the root directory?

      I would like to add push notifications to my site and I need to add the code to the root directory.
    • Templates when adding a ticket

      Hello, When adding a ticket and crafting a description is it possible to have the templates available? I would like to do it all at once vs creating the ticket then navigating to the ticket to send the initial contact. Thank you,
    • Facing issue in getting data through api calls

      I have send data of users and want to get the data oof users but facing issue with one field for that I want help
    • invokeURL to change custom field

      I have a deluge script that currently runs as a Schedule. It works exactly as intended, however I've recently been informed by Zoho that there's some mechanism in place to block changes made by a script when it runs on a schedule from being detected by
    • How to stop workflow running twice on a record

      Hi I have a workflow as below Trigger: Lead record is created/edited - Repeat this workflow whenever a lead is edited is NOT TICKED Condition: When Lead Stage is MQL Action: Reassign Lead, Create Task If the Lead goes into stage MQL, and then it changes
    • Retrieving a sandbox

      Is there a way to retrieve a previous sandbox build?
    • Calculate your investment's value with the NPV, PV, and FV functions in Zoho Office Integrator

      Hi users, We are pleased to introduce three new formulas in Zoho Office Integrator's document editor: Net Present Value (NPV), Present Value (PV), and Future Value (FV). These formulas allow you to calculate the value of your investment over a specific
    • Best Way to Integrate a Shared Sales Inbox with Zoho CRM

      I’m setting up a shared email inbox (e.g., sales@mycompany.com) for our sales team and want to integrate it with Zoho CRM Leads and Deals so that multiple team members can collaborate efficiently. Since Zoho CRM doesn’t support IMAP for shared inboxes,
    • Last name is being added into first name

      We have noticed in our campaigns that the last name is being included with the first name for some people. We have gone through the CRM and they are all entered correctly. Does any one have any ideas how why and how to fix this?
    • Kiosk Page Refresh

      We have a Kiosk running from a button in contacts to update values and also add related lists, which works great, but when the kiosk is finished the page does not refresh to show the changes. Is there a way to force the contact to refresh/update when
    • Sending User-centric reports to all users

      I would like to automate an e-mail report to all users that sends them a weekly e-mail listing their open Potentials.  I've created a Report that uses the ${CURRENTUSER} criterion and scheduled the report to send to several users, but they all receive
    • Let's build a dashboard with Cliq Widgets!

      While juggling multiple tasks and tracking real-time data, you face a strict deadline for delivering a quarterly analysis report on a blank canvas while switching between different apps. Sounds exhausting, right? What if you could streamline everything
    • Merge Join PDFs Zoho Creator

      Hi all, I have a field where users upload PDF, is it possible to join those pdfs into one with a function or something? Regards.
    • It's time to say goodbye to Zoho Recruit for me.

      Hello, I have been a Zoho Recruit user since 2013. The tool has evolved, with a better UI, new features and so on. The pricing is still a great asset too. BUT, that being said, important features are not coming fast enough. I tried to share my point of
    • how to send recurring estimates instead of recurring invoices

      Hello, Is it possible to use the recurring invoice functionality to send recurring estimate to our customers ? We first need to send them an invoice in order to receive their purchase order and then send them the invoice with their purchase order number
    • View Reference Values in pick list field not showing

      Dears, I want to create a custom field, type "Pick List", to define the language of a Lead. I want a pick list with some options value ("en", "fr", "de", etc.) and I want to display this options with a reference ("English" for "en", "Français" for "fr",
    • Quais são os maiores desafios que você enfrenta ao implementar o Zoho CRM?

      Olá, pessoal da comunidade Zoho Brasil! Sou parceiro autorizado da Zoho e, ao longo do tempo, tenho notado que cada implementação de CRM traz desafios únicos, dependendo do segmento de negócio, das metas da empresa e até da familiaridade da equipe com
    • How to download Renamed File that already updated to Zoho Creator.

      Hi members, I construct a button with report workflow. link = "https://creatorexport.zoho.com" + zoho.appuri + "report_link_name/File_upload/image-download/" + input.File_upload; openUrl(link,"new window"); This script able to download the file. But I
    • [ Free Webinar] Transform your hiring process with Zoho Recruit's AI tools

      We are conducting a free webinar (on 26th November, 05:00 AM IST - 06:00 AM IST) designed to help you make the most of Zoho Recruit’s AI capabilities and give you a sneak peek into our future roadmap. Why Attend? In this session, you will: Discover how
    • Zoho invoice doesn't support Arabic language

      I added a clause in the terms & conditions section in Arabic but it doesn't appear when I sent or print it.
    • Reports - Billable Hours

      Hello, I have been playing around with some of the reports features but haven't yet been able to generate a report outlining Tickets which have been closed, that have billable time entries - defined against customer accounts - I can run a report showing
    • 📣📣 Zoho Bookings - Feature Roadmap 2024

      Hi Everyone, Thank you for all the support you have been showing Zoho Bookings. We had a fabulous 2023, with a bunch of new features and over 60K new users. In 2024, our prime focus will be on user experience, and we have a few vital features coming in
    • Couldn't connect to host, port: wordpress2224249.home.pl, 143; timeout 10000

      Hey, i get a error up "Couldn't connect to host, port: wordpress2224249.home.pl, 143; timeout 10000" But i tried same passwords and info. to make imap on hotmail. and it works flawlessly. Has to be something with zoho....
    • Using lookup field in Formula field

      I created the following formula field to get string output based on Lookup field values Lead and Account: if(${Communications.Lead}!='','Lead',if(${Communications.Account}!='','Account','Other')) The syntax seems correct, but I'm still getting an error.
    • Customize the ticket ID for enhanced ticket tracking

      Hello everyone, Ticket IDs in Zoho Desk are the unique reference numbers that are assigned to tickets when they're created. Agents generally use the ticket ID to locate a particular ticket and to reference a ticket in conversations and feeds. When customers
    • Set a global default filter to All Candidates view

      Hi, Is it possible to set a global filter to the All Candidates view? As a use case would be for off-limit candidates. These are those who are off limits due to previous bad client feedback on performance/behaviour. Ideal use case would be to set these
    • Can't join canal Developers Zoho User

      Hello, I received an invitation to join this channel, but I get an error when I try to join it, and I get the same error when I go to the Zoho Cliq interface > Search for a channel. Is this because I don't have a license linked to this email address?
    • Searching for content within courses

      Hello, I have been testing out Zoho One for my company have been exploring Learn. I've noticed that you cannot search for content within a course. You can only locate the title of the course. Example: Course: How to Make Your Bed Chapter: Pillows Lesson:
    • Remove "Additional Information" options from user-created tickets

      I'd like to configure customers to be able to create tickets themselves, with and without logging in. However, I don't want them to set things like the priority or due date. Is there a way to remove these options from the help center when customers create
    • Issue Loading Dynamic Table Fields in Zoho Writer

      I am experiencing an issue while configuring a repeat table in Zoho Writer. When attempting to insert a dynamic table, I receive the following error: "There was a problem loading your dynamic table fields. Please try again in a while." I have already
    • FSM Function not executing

      Good Afternoon, all I am working on a workflow function in FSM and yesterday it was working fine. Now today when I select "Save & Execute" it does nothing. I even tested it with just a info statement and it is not executing. Any help would be greatly
    • Announcing Early Access to "Zoho CRM for Everyone" — A new and exciting update to Zoho CRM

      We are delighted to announce an Early Access to Zoho CRM for Everyone— a truly democratic approach to managing a CRM, gift-wrapped in an exciting and intuitive user interface. Here, multiple teams across an organization can coordinate among each other
    • API - Inactive user

      Hi We have a complex flow set up with an API. Yesterday I needed to inactivate a user who had set up the flow and API- realised after this, then broke the connection so - re-activated the user. The flow now seems not to work when gaining information from
    • Based onthe multipick list value want to Show in the pick list field

      Based onthe multipick list value want to Show in the Single pick list field Database Region is multipick list if it contain Saudi and UAE then region pick list want to show Saudi and UAE Database Region is multipick list if it contain Saudi then region
    • Next Page