Tip #1 Automating online sales order to invoice conversions in Zoho Inventory

Tip #1 Automating online sales order to invoice conversions in Zoho Inventory


Hello,
 
Hope the day is treating you well.
We've been getting more than a few requests from online sellers who use Zoho Inventory to help them automate invoice generation for all online orders that drop into Zoho Inventory automatically from a sales channel or a shopping cart that they have integrated. Are you an online seller like them? Then we've got some exciting news for you. You can do it with the help of a few simple things that we'll see here today.

So how do we go about this?
If you have integrated online sales channels like Amazon, Etsy and Ebay or a shopping cart like Shopify to Zoho Inventory, then you will be aware of sales orders being automatically generated inside of Zoho Inventory whenever your online customers buy something from you through these integrated channels. Since invoices are generated and automatically sent to your clients by the channel, you have little need of the invoices inside of Zoho Inventory apart from accounting purposes. Depending on the amount of online orders you get per day, it can get tricky to convert these orders into invoices manually. So we are going to automate this part for you with the help of a simple custom function. 
 
Wondering what custom functions are? They are one of the automation tools at your disposal inside of Zoho Inventory and can be accessed inside of Settings. To know more about custom functions in general, please refer to our help document.
 
Now let's see how we can write one to automatically convert all online sales orders into invoices as soon as they are generated within Zoho Inventory. 
 
Log in to your Zoho account and click on this link to generate an Auth Token which is required to make this work.
 
1) Open your Zoho Inventory organization.
2) Navigate to Settings using the gear icon from the top-right corner.
3) Select Automation from the sidebar. Click on the +New Workflow Rule button that is found at the top-right corner.
4) Out of the four tabs within Automation, select Custom Functions.
5) Now let's add a name for this workflow rule. (Note: Name cannot contain spaces)
6) The module to be chosen is Sales Orders.
7) Add a description if you need one.
8) Now, the workflow type is going to be Event Based.
9) And for the trigger, choose the option - "When a Sales Order is" "Created".
10) In the deluge pane, copy and paste the following code snippet:
 
salesorderID = salesorder.get("salesorder_id");
salesorderdate = salesorder.get("date").toDate();
organizationID = organization.get("organization_id");
authtoken = "
Copy and Paste your auth token in place of this text";
sal = invokeurl
[
url :"
https://inventory.zoho.com/api/v1/salesorders/" + salesorderID + "?authtoken=" + authtoken + "&organization_id=" + organizationID
type :GET
];
temp = sal.get("salesorder");
// info temp;
new = temp.get("sales_channel");
if(!new.equalsIgnoreCase("direct_sales"))
{
bson = Map();
customerID = salesorder.get("customer_id").toString();
salesoderdate = salesorder.get("date").toDate();
//invoice_number = salesorder.get("salesorder_number").replaceFirst("SO","INV");
//bson.put("invoice_number",);
bson.put("customer_id",customerID);
bson.put("date",salesorder.get("date"));
lineItems = salesorder.get("line_items").toList();
newLineItems = List();
for each lineItem in lineItems
{
lineItemMap = Map();
solineitemID = lineItem.get("line_item_id");
lineItemMap.put("salesorder_item_id",solineitemID);
id = lineItem.get("item_id");
lineItemMap.put("item_id",id);
des = lineItem.get("description");
lineItemMap.put("description",des);
wh = lineItem.get("warehouse_id");
lineItemMap.put("warehouse_id",wh);
quantity = lineItem.get("quantity");
lineItemMap.put("quantity",quantity);
r = lineItem.get("rate");
lineItemMap.put("rate",r);
d = lineItem.get("discount");
lineItemMap.put("discount",d);
tidd = lineItem.get("tax_id");
lineItemMap.put("tax_id",tidd);
tex = lineItem.get("tax_exemption_code");
lineItemMap.put("tax_exemption_code",tex);
newLineItems.add(lineItemMap);
}
bson.put("line_items",newLineItems);
if(temp.get("is_taxable").equalsIgnoreCase("true"))
{
bson.put("tax_id",temp.get("tax_id"));
}
else
{
bson.put("tax_exemption_id",temp.get("tax_exemption_id"));
bson.put("tax_authority_id",temp.get("tax_authority_id"));
}
response = zoho.inventory.createRecord("Invoices",organizationID,bson);
info bson;
info response.toMap().get("message");
inv = response.get("invoice");
info inv.get("invoice_id");
//marking as sent//
invoiceID = inv.get("invoice_id");
invoicedate = inv.get("date").toDate();
respond = invokeurl
[
url :"
https://inventory.zoho.com/api/v1/invoices/" + invoiceID + "/status/sent?authtoken=" + authtoken + "&organization_id=" + organizationID
type :POST
];
info respond.toMap().get("message");
}
else
{
info "Order is not from a Marketplace";
}
 
11) Before you save, you are required to copy and paste your auth token inside the quotes in the 4th line that says: authtoken = "Copy and Paste your auth token in place of this text";
Note: The auth token is a critical piece of information that helps the system identify you, so keep yours safe and confidential. Do not share it with anyone, not even with folks from Zoho.
12) Now, hit Save to finish.
 
Henceforth, all your online sales orders that are auto-generated from Amazon, Etsy, Ebay or Shopify will be automatically converted to invoices. And the status of these invoices inside of Zoho Inventory will be Sent. If you wish to auto-generate invoices of Paid status, then it can be made possible with a few changes. You can either experiment that part by yourself or contact us at support@zoho-inventory.com
 
Note: If you need this automation only for one channel, say for Shopify alone and not other channels, then you need to make a few changes to line 13 that originally says - if(!new.equalsIgnoreCase("direct_sales")) to if(new.equalsIgnoreCase("shopify"))
 
Hope this helps you in your online selling endeavors. Oh and by the way, have you ever dabbled with the custom functions module by yourself? You can share your discoveries, questions and suggestions with us anytime. We look forward to hearing from you. (Email us: support@zoho-inventory.com)
 
Until next time.
 
Your everyday end user,
Ajay Aadhithya Chandrasekaran
Zoho Inventory


    • Recent Topics

    • Search function not working anymore

      Hi! The search function is not working anymore. How can we solve this problem?
    • When converting a lead to an account, the custom mandatory fields in the account are not treated by zoho as mandatory

      In my Account module I have a number of custom fields that I have set as mandatory. When I enter a new customer as a new account they work, I can't save the record without populating them. However when I convert a lead, my CRM users are able to save the
    • Expand Zia's Language Support and AI Capabilities

      Dear Zoho Desk Support, I would like to submit a feature request to improve Zia, the AI-driven support assistant in Zoho Desk. Currently, Zia only supports the English language, while other AI agents such as Gemini, ChatGPT, and Claude can work with a
    • get gettting the days number between two dates with deluge

      I am trying to calculate the days number between 2 specific dates but its not working. PLease help me.
    • How do I add more schedules to Zoho Creator?

      At the moment, the number of schedule calls we have in Zoho Creator are 1800 per month and I was wondering if it was possible to upgrade that amount to something higher. I'd like to know my options as well as the pricing.
    • Conexion CREATOR x CRM

      Buenas tardes, Tengo un problema con un código que crea un registro en CRM. Revisé el CRM para eliminar los campos obligatorios, pero cuando ejecuto el programa, aparece el siguiente mensaje de error: {"code":"MANDATORY_NOT_FOUND","details":{"api_name":"data"},"message":"required
    • Invoices with billable time and expenses

      I cannot seem to get a straight answer. We are looking to create an invoice to send to our clients, but it needs to have the following on it: 1. Billable hours for each employee. All hours for the pay period on one line, by employee. 2. Expenses for each
    • Search Bar Improvement for Zoho Commerce

      Hey everyone, I've been using Zoho Commerce for a bit now, and I think the search bar could really use an upgrade. Right now, it doesn't show products in a dropdown as you type, which would make finding items a lot faster. On Shopify, for example, you
    • Send Whatsapp with API including custom placeholders

      Is is possible to initiate a session on whatsapp IM channel with a template that includes params (placeholders) that are passed on the API call? This is very usefull to send a Utility message for a transactional notification including an order number
    • Can't get form response to populate custom PDF template

      I've created a template and set it to default but can't figure out how to get the response to populate that template. It keeps giving me the default summary.
    • Zoho Sheets not compatible with Excel/Google Sheets

      In order to share a copy of a Zoho sheet with someone that does not use Zoho, it must be downloaded as MS Excel format and then added to an email.  This is a labor intensive, and frankly confusing process.  I have forgotten to do this before, only to
    • Add Ability to Designate Decision Branches as "Error Branches"

      Zoho Flow gives the ability to track down, troubleshoot, and fix errors with the Status and Filter dropdowns in the History tab. This works well for when a "normal" Flow action registers with an error. However, there are other times where it would be
    • Visitors sending message via Whatsapp are not saving on contacts

      Visitors who sends me messages from Whatsapp when i finish the chat do not populate on contacts, how can I add them as contacts?
    • ChatGPT only summarize in English

      Hello i' v enabled chatgpt in salesIQ, it works great inside conversation (revise, Rephrase etc) add tags works well with another language than English. But when I want to summarize it render only in English, despite sales IQ is set to another language.
    • Brand with multiple facebooks pages

      HI, We are a small publisher that has different FaceBook pages for each of our product lines. All are within the same FB account.   Is it possible to add all of these pages to our one brand in zoho social so I orchestrate the posts between the different products?    Cheers, Joe
    • How do I connect Sales IQ to Shopify

      How do I connect Sales IQ to Shopify.    
    • DORA compliance

      For DORA (Digital Operational Resilience Act) compliance, I’ll want to check if Zoho provides specific features or policies aligned with DORA requirements, particularly for managing ICT risk, incident reporting, and ensuring operational resilience in
    • Create Ticket from Chat with Rest API

      Hi to everyone, is possible to create a ticket from Chat with Rest API? In user interface is possible by clicking on the button "Convert chat as a ticket". Anyone know how to do that? Thanks
    • How to send binary data in invokeurl task?

      Hello, I am using Adobe's Protect PDF API. Source: https://developer.adobe.com/document-services/docs/overview/pdf-services-api/ Everything works fine in Postman. But for some reason after encrypting the file, it is empty after password protecting the
    • How Can I Customize Sales Reports in Zoho CRM to Better Track Our Sales Team's Performance?

      Hello everyone, I'm new to using Zoho CRM and need some help with customizing our sales reports. We want to track our sales team's performance more effectively and visualize trends that can inform our strategy. What specific customizations or features
    • Items should display under specific warehouse

      I have configured the multi warehouse but it show all the items under all warehouse which is not correct according to our business logic, so i want that items should only display under that specific warehouse not under all the warehouses not even with zero quantity. Some items should be common but not all so is there any option for that purpose so i can specific the items to its warehouse. Regards
    • Package Dimensions

      Packages need to have dimensions that are sent to carriers in addition to just the weight. Without the package dimensions being transmitted to carriers, the correct dimensional weight is not calculated for the label price, which results in corrections
    • Theft Prevention Sensor Integration in Zoho Inventory

      Is there a way to integrate a theft prevention sensor with Zoho Inventory, so items cannot leave the store unless they've been scanned at checkout? Any insights or existing solutions would be greatly appreciated.
    • Zoho Workplace gets yet another security boost: The addition of Zoho Vault

      Hello Community, Passwords are often the first line of defense, yet they're also one of the most common weak points. We're thrilled to announce that Zoho Vault is now integrated with Zoho Workplace! Zoho Vault Standard is now included at no extra cost
    • "notes"-field in a task to full width?

      Hi, Is there someone that can tell me how to adjust the "notes"-field in a task, to full width? I already played around with 1 or 2 columns, but this has nu effect on the standard width. Thx in advance for your help. Cheers, Ralph.
    • How to download Job Sheets in Zoho FSM?

      Hello, I'd like to download copies of completed job sheets as PDF's for upload to a workdrive to keep an audit record of completed Job checkout sheets. I do not see download of this file type as an option - any help is appreciated!
    • [Webinar] Zoho Writer for law firms and legal professionals

      Are manual processes slowing down your legal practice? Are you ready to simplify document management and free up more time for your team to focus on what truly matters? Join us on January 16, 2025, for an exclusive Zoho Writer webinar designed specifically
    • Introducing Bin Locations In Zoho Inventory

      Hello users, We are excited to let you know that your wait for the Bin Locations feature has now come to an end! Yes, you heard us right! We are here to introduce the much-awaited Bin Locations now in Zoho Inventory. But before we dive into the feature
    • How to send mail with js SDK

      Hell o I'm using https://live.zwidgets.com/js-sdk/1.2/ZohoEmbededAppSDK.min.js, for my widget in CRM (built with sigma) Is it possible to send email from js file, I try ti use that ZOHO.CRM.API.sendMail({ "Entity": "Accounts", "RecordID": sharedVariableEntityId,
    • Cannot add Zoho Forms link to LinkedIn

      Hello, We have encountered a problem where we are unable to share a Zoho Forms link on LinkedIn. This is what we got from LinkedIN, but we have not heard back from Zoho Support as yet, and we are meanwhile stuck... "It seems the URL does not scrape the
    • Feature request - pin or flag note

      Hi, It would be great if you could either pin or flag one or more notes so that they remain visible when there are a bunch of notes and some get hidden in the list. Sometimes you are looking for a particular name that gets lost in a bunch of less important
    • i keep see there is a connetion issue connecting 3rd party api on zoho when using zia

      hi there , i have set up open ai api to zoho zia (copied and pasted to zoho zia) but I keep getting notificaiton "there is a connetion issue connecting 3rd party api on zoho" when using zia on top when click zia and try to type in word there
    • SendMail in CRM Deluge function rejects a validated email address

      In a CRM Deluge function, the email address is considered invalid. Is there another method by which it can be validated? It's unacceptable in my current situation to use either the zoho.loginuserid or adminuserid as the From address.
    • how do i remove a specific Zoho Service from my account

      I no longer need Zoho CRM, ZRM Assist nor ZRM BugTracker. How do I remove them from the list of apps for my account?
    • Build custom AI solutions with Catalyst’s QuickML capabilities in CRM

      Hello everyone, We’re thrilled to announce an improvement for our Zoho CRM Enterprise users: the ability to create custom AI solutions using Catalyst’s QuickML directly from Zoho CRM. As you may already know, Zia, Zoho CRM’s AI-powered assistant, offers
    • Unveiling Cadences: Redefining CRM interactions with automated sequential follow-ups

      Last modified on 01/04/2024: Cadences is now available for all Zoho CRM users in all data centres (DCs). Note that it was previously an early access feature, available only upon request, and was also known as Cadences Studio. As of April 1, 2024, it's
    • Pay Contractor Timesheets

      I have contractors that fill out a timesheet. Each hour must be assigned to a current client. I need the easiest way to get the contracts paid. They are paid on an hourly bases. How can this be done?
    • Set up slack alert based on a field changing from one option to any other

      Hi, I'm trying to set-up a workflow to send a slack alert if a field changes from one option to any other. I've set-up a workflow to trigger on Edit and when a specific field gets modified but the only option I have 'is modified to' when really it should
    • Better UI more user friendly

      Hello everyone, I think all finance apps, especially Zoho Books, would benefit from the following suggestions/ notes: 1. Grouping Fields in Zoho Books: Unlike Zoho CRM, Zoho Books does not seem to have an option to create sections or group fields. This
    • Chronicles of 2024: The Year in Retrospect

      As we close out 2024, let’s take a moment to highlight the new features and updates that have enhanced Zoho Invoice in 2024. Among the exciting enhancements, we have launched a new AI-powered chatbot designed to assist you in understanding the app's features
    • Next Page