Zoho Inventory

Back to Automation

Workflow Scenarios

Workflows can come in handy if you wish to get things done automatically in Zoho Inventory. Following are some of the scenarios where workflows come into play.

Scenarios for Email Alerts

Scenario 1:

Dillion Inc. is a garment export company. The VP of sales wants to receive email alerts when an employee raises a Sales Order for an amount greater than 10,000 USD for one of their top customers. This will help them offer their best services. In that case, a workflow can be designed to automatically trigger email alerts when the following conditions are met.

Execute When: Created
Rule Criteria: Sales Order amount is greater than 10,000 USD.
Immediate Action: Email alert to the VP of Sales/ Finance team.

Scenario 2:

Joseph, the CTO of Bookworm.com, an online bookstore wants to implement a system wherein an alert message should be triggered to the packing section, upon raising an invoice for an order placed by the customer. The Email Alerts feature allows him to accomplish this by creating a workflow rule with the following parameters.

Execute When: Created or Edited
Rule Criteria: Contact Name is XYZ
Time Based Action: Email alert to the packing section upon raising an invoice.

Scenario 3:

Adrian is the head of the travel department at Fossil Petrocorp, a company that specializes in finding efficient ways to use non-renewable sources of energy. Their engineers keep travelling across the globe to do business with major petroleum companies. Adrian’s job is to make sure their air tickets are booked and paid for by the company on time. So, whenever Adrian books a flight ticket for his colleagues through their travel agent, he wishes to send an acknowledgement mail to the agent that they have received the bill and would make the payment before the due date.

Execute When: Created or Edited
Rule Criteria: Company Name is ABC Travel Agency and Status is Open. Time Based Action: Email alert to the travel agent upon creating a bill for the air tickets.

Scenarios for Field Updates

Scenario 1:

Andrew is the Head of Marketing of SolarSync, a solar panel manufacturing company. According to his newly issued directive, the sales person should be changed to “XYZ” as soon as the sales person “ABC” has landed the sale i.e when an invoice for a Total Amount greater than 10,000 USD has been created or edited. A workflow automates the process of re-assigning the task to another person by setting up the following parameters to execute the directive.

Execute When:   Created or Edited
Rule Criteria: When Sales Person is “ABC” and Total and Total Amount is greater than 10,000 USD.
Immediate Action: Update Sales person field to “XYZ”

Scenario 2:

MobileCave Inc. owns a chain of stores that sells mobile phones. They constantly order phones from different vendors. The purchase department often faced the difficulty of receiving the shipments on time as their vendors also supply to several other stores in the city.

The purchase department figures out a way to overcome this by alerting the vendor a week before their promised delivery date. According to the purchase team, this can be achieved by creating a workflow that will be executed whenever a purchase order was raised for 2000 USD or more.

Also, another workflow was set to update the Notes field that has a short message to the vendor requesting them to deliver the goods on time and if they did, they can expect more orders from MobileCave Inc. in the future.

Execute When:   Created or Edited
Rule Criteria: When Company Name is “ABC” OR Total is greater than 2000 USD.
Immediate Action: Update Notes field with a message to deliver the goods on time.
Time Based Action: Email Alert 7 days before Expected Delivery Date.

Note: In the above scenario, two separate workflows need to be created for the Immediate and Time based actions.

Scenario 3:

Andrew is the owner of Phoenix Rent-a-Car, a car rental company in Chicago. One of his regular customers has rented a car for a month. Andrew sends him an invoice for 1500 USD for a period of 30 days i.e 50 USD/day i.e 1500 USD/month. He has also offered his customer a discount of 500 USD. However, he wishes to update the Customer Notes 10 days after the Invoice Date by offering him a few freebies as well. He can automate this task by setting up the following parameters.

Execute When: Created or Edited
Rule Criteria: When Total=1000 and Discount > 500.
Immediate Action: —
Time Based Action: Update the field Customer Notes 10 days after Estimate Date.

Scenarios for Webhooks

Scenario 1:

Greg is the Public Relations manager for a Home & Office Security company. A First-Time customer had asked for setting up security systems for his office in Boston. Greg wants to make a good impression by promptly sending a ‘Thank You’ SMS as soon as the Sales is made. The webhooks feature in automation can do that by setting the following parameters and connecting to a SMS gateway.

Execute When: Status is Confirmed
Rule Criteria: When Contact Name is “XYZ” and Contact Type is “Customer”.
Immediate Action: SMS alert using a webhook with SMS gateway.
Time Based Action: —

Scenario 2:

Frank is the financial controller of a Stock Brokerage firm. Most of the company’s revenue is credited into the company’s official Stripe account. He wants to be notified of any high value deposits or withdrawals towards invoices or purchases from that account via Email or SMS, on a weekly basis. He can achieve that by setting up a webhook using the following parameters.

Execute When: Created or Edited
Rule Criteria: When Total Amount>=$10,000
Immediate Action: —
Time Based Action: Trigger SMS 7 days after Rule Trigger Date


Scenarios for Custom Functions

Scenario 1:

Applying a 10% discount automatically when your customer’s invoice total exceeds $200

Sarah runs a supermarket and she wishes to provide discounts to celebrate her store’s 10th Anniversary. She decides to give a 10% discount for anybody who makes a purchase for $200 or more. It would be a painful task to add the discount on every invoice repeatedly.

With custom functions, she can write a small piece of code to automatically execute this action if the total of the invoice exceeds $200.

Let’s have a look at the custom function for this scenario.

Workflow Rule Name: anniversary_discount

Description: Apply a 10% discount when the invoice total exceeds $200

Module: Invoice

Workflow type: Event based

When an invoice is: created

Triggers: When total >= 200

Script:

//create a variable and get the invoice total
total = invoice.get("total").toDecimal();
//set a condition: when invoice amount is greater than or equal to $200
if ( total >= 200.00 )
{
adjustment = invoice.get("adjustment").toDecimal();
adjustment = adjustment - total * 0.10;
jsonstring = "{\"adjustment\":" + adjustment + ",\"reason\":\" DISCOUNT \"}";
// To update the current record
zoho.inventory.updateRecord("Invoices", organization.get("organization_id"), invoice.get("invoice_id"), jsonstring.toMap());
}

Now, when the invoice total is greater than or equal to $200, the workflow will be triggered and the custom function will be executed.


Scenario 2:

Adding a 5% late fee when an invoice becomes overdue

Dennis runs a self-storage facility in Manhattan where customers can store anything in a locker, small enough to safely store documents and, big enough to store an expensive car. He charges his clients the option to pay on a daily, weekly, monthly or even a yearly basis. He offers them a 10-day grace period from the invoice date to make the payment after which, he charges an additional 5% of the invoiced amount as late fees.

Using custom functions, he writes a small code to automatically calculate the late fees and add it as adjustments in the invoices that are overdue.

Let’s have a look at how the custom function is designed for this scenario.

Workflow Rule Name: late_fee

Description: Apply a 5% late fees on the invoice amount

Module: Invoice

Workflow type: Date based

Date of Execution: 0 day(s) after Due Date

Execution time: Enter the time of execution

Execution cycle: Once

Triggers: When » Status » isn’t » Paid » AND » Status > isn’t » Partially Paid

Script:

//create a variable to get invoice total and add a 5% discount
latefee = invoice.get("total").toDecimal() * 0.05;
//display the value stored in the latefee variable
info latefee ;
//add late fee and adjustment and store the total amount in the variable 'adjustment'  
adjustment = invoice.get("adjustment").toDecimal()+ latefee;
jsonstring = "{\"adjustment\":" + adjustment + ",\"reason\":\" late fee\"}";
// To update the current record
result = Map();
result = zoho.inventory.updateRecord("Invoices", organization.get("organization_id"), invoice.get("invoice_id"), jsonstring.toMap());
info result;

Now, when the invoice due date exceeds the set date (in the workflow rule), the workflow will be triggered and the custom function will be executed.


Scenario 3:

Provide discount if payment for the invoice is made before the due date

Donna runs a design firm that creates promotional materials for websites on a monthly basis. This involves designing brochures, banner ads, and other promotional materials. Donna sends invoices at the end of each month and often receives payment only after the credit period, which is 30 days. To receive funds immediately, she decides to offer a discount if the invoice amount was paid before the invoice due date.

In order to implement this, she adds a discount of 5% to her invoices and in the customer notes section she mentions that the discount would be applicable only if the payment is made before the due date.

She creates a custom function. The parameters of the workflow rule is mentioned below:

Workflow rule name: early_payment_discount

Module: Invoice

Workflow type: Date based

Date of Execution: 0 day(s) after Due Date

Execution time: Enter the time of execution

Execution cycle: Once

Trigger: When » Status » isn’t » Paid

Script:

//if payment for the invoice is received after the invoice due date then discount won't be applied
jsonstring = "{\"discount\" : 0, \"reason\" : \"Due date exceeded\"}";
zoho.inventory.updateRecord("invoices", organization.get("organization_id"), invoice.get("invoice_id"), jsonstring.toMap());


So, if an invoice reaches the due date, the workflow will be triggered and the custom function will add 0% discount instead of the actual 5%


Scenario 4:

Automatically set due date for an invoice as 30 days before the event date (that is entered via a custom field)

Tom is a creative wedding photographer. His clients book his services 2-3 months prior to the wedding date (event date). Tom would confirm the date only if the client pays the full amount 30 days before the wedding date. In order to streamline this process, Jake, one of the members of Tom’s studio writes a small custom function.

To start with, Jake creates a custom field named ‘Wedding Date’ with the date datatype and writes the following custom function for it:

Workflow name: advance_payment

Module: Invoice

Workflow type: Event based

When invoice is: Created

Script:


customFields = invoice.get("custom_fields").toList();
cfDate = null;
for each  customField in customFields
{
customField = customField.toMap();
if(customField.get("label") == "Date")
{
cfDate = customField.get("value");
}
}
duedate = cfDate.toTime().subMonth(1);
info duedate;
duedate = duedate.year() + "-" + text(duedate.month(),"00") + "-" + text(duedate.day(),"00");
jsonstring = "{\"due_date\":" + duedate + ",\"reason\":\" Duedate changed. \"}";
result = zoho.inventory.updateRecord("invoices",organization.get("organization_id"),invoice.get("invoice_id").toString(),jsonstring.toMap());
info result;

While creating an invoice, if Tom mentions the wedding date in the custom field, the workflow will be triggered and the custom function will set the due date of the invoice to 30 days before the wedding date.


Scenario 5:

Extend due date by 7 days if the customer pays 50% of the invoice amount on or before the initial due date

Dianne owns a store that supplies printing paper and office stationery for offices in her area. She wants to extend the due date of the invoice by a week if customers pay 50% of the invoice amount on or before the initial due date.

In order to do that, she writes the following custom function:

Workflow name: Extend due date

Module: Invoice

Workflow type: Event based

When invoice is: Edited

Execute the workflow When any field is updated

Just once or Everytime? Just once

Triggers When » Status » is » Partially paid

Script:

//Getting invoice total, balance after the partial payment, and due date
inv_total = invoice.get("total").toDecimal();
inv_balance = invoice.get("balance").toDecimal();
inv_duedate = invoice.get("due_date").toDate();
orgid = organization.get("organization_id");
invid = invoice.get("invoice_id");
//Condition to check if the amount paid is 50% of the invoice amount
if(inv_balance == inv_total / 2)
{
inv_duedate = inv_duedate.addDay(7);
inv_duedate = inv_duedate.year() + "-" + text(inv_duedate.month(),"00") + "-" + text(inv_duedate.day(),"00");
//Update the due date by 7 days
jsonstring = "{\"due_date\" : " + inv_duedate + ", \"reason\" : \"Due date extended\"}";
result = zoho.inventory.updateRecord("invoices",orgid,invid,jsonstring.toMap());
}

Now, when a customer pays 50% of the invoice amount by the initial due date, a grace period of 7 days will be given for him to pay the balance amount.


TOP