Function #25: Automatically generate purchase orders from a sales order

Function #25: Automatically generate purchase orders from a sales order

We kicked off the "Function Fridays" series with the goal of helping you automate your everyday accounting tasks. As we delve into today's post, I'm delighted to announce that we're here to present the 25th custom function in this series. While it is a small milestone, we are committed to continuing this series to provide more functions that can save you time and significantly enhance the efficiency of your business operations. You can find a complete list of all the functions we've shared to date by visiting this link. 

Coming to today's function, you're likely familiar with the feature in Zoho Books that allows you to raise multiple purchase orders from a sales order when item quantities are running low or depleted. If your sales order has several low-stock items that must be procured from different vendors, manually creating separate purchase orders for each vendor can become quite a time-consuming task. To streamline and simplify this process, you can set up a workflow rule that will trigger the automatic creation of purchase orders.

Here's how it works: Let's take the example of John, a retail business owner who has received an order. While he's in the process of creating the sales order, he notices 2 items whose stock levels need to be replenished to fulfill future orders. During the sales order creation in Zoho Books, John can simply use a checkbox-type custom field (specifically created for this purpose) to mark the items that need to be ordered. From that point, Zoho Books takes over.



The custom function is executed to generate purchase orders for all the marked items. The choice of vendor in the purchase orders is based on the preferred vendor assigned to each item. If there are multiple items in the sales order with the same preferred vendor, the system will consolidate these items and add them to a single purchase order.

Prerequisites: 

1. Create a check box-type custom field for the items by the name "Generate PO" to be displayed in the item table of sales orders. When creating a sales order, it's necessary to tick this checkbox to initiate the creation of a purchase order for the item.



2. It's important to fill in the "Preferred vendor" field in the item details screen so that the purchase orders are raised for the corresponding vendor. Do note that the "Preferred vendor" field will be displayed only when the Purchase information of the item is enabled.




3. Create a Connection named "zbooks" to successfully execute the function. You can watch the GIF attached below to know how to create the connection.



Custom Function:

Navigate to Settings -> Automation -> Workflow Actions -> Custom Functions -> +New Custom Function > Add the function code from this GitHub link.
 
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.

This function will not just be a time-saver but also help you maintain optimum inventory levels required to fulfill customer orders. Should you need any help in configuring this function, remember, that we're just an email away. Feel free to drop your queries to support[at]zohobooks[dot]com. We're always available to provide the assistance you need! 

Regards,
Shireen Farhana S
Zoho Books

    • Recent Topics

    • Changing naming convention for Estimates

      Hi there, How do I customise the naming of the filenames for estimates when sending them? Currently they are named literally just ES11.PDF or whatever the number of the estimate is. There is no Company name, description of the work, customer name, date
    • Email templates for estimates

      Hi there, When I send an estimate the option to choose a template appears. However it is common to need to make some minor personalizations and modifications to the email before sending ie. adding a second person to the greeting, or adding a small note
    • Reading emails sent from Zoho

      Hi there, How do I view an email sent from Zoho, for example an email which contains an estimate? I can see there is a tab in the screen for that estimate which is labelled 'Emails' and I can see a summary of the email sent listed there, but I cannot
    • Editing Estimates

      Hi team, How do I delete line items in an estimate when editing it? I can't see any option to do this - no X, no trashcan, no drop down... And how do I revert to the original estimate after cloning? I cloned to see if the option to edit were disabled
    • Customer Message Edit/Delete Function & Backend Visibility Inquiry

      目前客服已发送的对话支持编辑和删除功能,请问在 Zoho 系统后台,是否可以查看客服具体发送了什么内容,以及删除或修改了哪些信息?如果无法查看,这个功能是否可以通过设置关闭客服的编辑和删除权限?如可以,请告知具体设置路径。 Currently, customer service agents are able to edit and delete messages after sending them. In the Zoho system backend, is it possible to view
    • In App Auto Refresh/Update Features

      Hi,    I am trying to use Zoho Creator for Restaurant management. While using the android apps, I reliased the apps would not auto refresh if there is new entries i.e new kitchen order ticket (KOT) from other users.   The apps does received notification but would not auto refresh, users required to refresh the apps manually in order to see the new KOT in the apps.    I am wondering why this features is not implemented? Or is this feature being considered to be implemented in the future? With the
    • Sync Task Status from Zoho Projects to Zoho Desk

      Hi Zoho Desk Team, Hope you’re doing well. We’re actively using the Zoho Desk–Zoho Projects integration, which helps our support and project teams stay aligned. However, we noticed that when we change a task’s status in Zoho Projects, the change is not
    • Automate the file import step

      Hello everyone, I have a Sales - 'Account' category, and currently import the file to update it as follows: Import Accounts - From File - Update existing Accounts only - select and match the field the CRM. Since we have been using Microsoft 365 SharePoint.
    • Lost the ability to sort by ticket owner

      Hi all, in the last week or so, we have lost the ability to sort tickets by Ticket Owner. Unlike the other columns which we can hover over and click on to sort, Ticket Owner is no longer clickable. Is it just us, or are other customers seeing this too?
    • Placeholder doesnt work in email tempalate

      Hi Team,  I have put in the customer happiness rating place holder in my email template but when I pick the template in my ticket and send it to client, the place holder doesnt get generated. What am I missing here? screenshot attached. 
    • Search API filter/sort ignores comment-triggered modifiedTime updates

      Summary When a comment is added to a Call or Account, the parent record's modifiedTime is correctly bumped. This bumped value is visible in: GET /api/v1/calls/{id} ✅ GET /api/v1/calls/search without a filter ✅ — the record's response body shows the new
    • Automation#17: Auto-Create Tasks in Zoho Projects Upon Ticket Creation in Zoho Desk

      Hello Everyone, This edition delivers the solution to automatically create a task in Zoho Projects when a ticket is created in Zoho Desk. Zylker Resorts uses Zoho Desk for bookings and handling guest requests. Zylker resorts outsources cab bookings to
    • Introducing parent-child ticketing in Zoho Desk [Early access]

      Hello Zoho Desk users! We have introduced the parent-child ticketing system to help customer service teams ensure efficient resolution of issues involving multiple, related tickets. You can now combine repetitive and interconnected tickets into parent-child
    • Schedule Timeout 5 minutes vs. stated 15 minutes

      I am running into a function run timeout error after 5 minutes for my schedules. The Functions - Limits documents states it should be 15 minutes: Functions - Limits | Online Help - Zoho CRM. What should it actually be? Due to the 5 minute timeout, I'm
    • Printing invoice from creator using writer

      Hello. I have created my invoices using Zoho Writer and i'm sending data to them from Zoho Creator by selecting a row in a report and then clicking a button which has workflow connected to it to send the date to the invoice in writer. This is working
    • Remove Bounced email addresses from CRM after running a campaign

      HI, Is there a simple way to remove bounced leads in the CRM where there email doesn't exist anymore after running a campaign?
    • CRM Notes

      Hello, We want to add a Note to the Contact record when a Note is added to a Case or Deal. I wasn't able to do this using a workflow, so I tried using Zoho Flow, but that didn't work either. Does anyone have a suggestion on how we can accomplish thi
    • Building a custom site

      do we have an option in Zoho to build custom sites like adding custom functionalities? want to make a site like jumble puzzle answers for today. Is it doable? Please assist.
    • How to Automate an Unsubscribe based on Scoring

      I automatically assign a negative point score to bounced emails and would like to automate unsubscription of these emails from our Campaigns, without losing the contact data. (Oftentimes the lead is no longer at a business, but I want to keep the business
    • Campaign Status Field in CRM

      I'm wanting to create a custom view in CRM that shows all those who have recently hard bounced in past campaigns so we can clean up the database. An old Zoho article said it was possible, but I don't see the option to push campaign status field to CRM,
    • Introducing PDF conversion in Deluge

      Hello everyone, We're pleased to introduce built-in PDF conversion capabilities in Deluge with the launch of the convertToPDF task. As PDF is one of the most widely used formats in professional environments, this task helps streamline document generation
    • Recurring Addons

      Hi, I know you can set the pricing interval for addons to weekly, monthly and yearly & set it for one off or recurring, which these are fine as a base addon item. It really would be helpful if when creating a subscription when you add on the addon item
    • Start Workflow from Deluge Script

      I have developed a customized process from our CRM that leverages a deluge script to create a statement of work document. Once the document has been created via the merge and store function, I would like the ability to start a workdrive review & approve
    • Re: Application Architecture in Zoho Creator — A Platform-Specific Deep Dive

      A recent community post on application architecture made some excellent points about planning architecture early in Zoho Creator projects. The core message is right — Creator applications have a habit of growing organically into maintenance nightmares,
    • Option+C shortcut conflict

      In the latest Cliq release, you introduced `Option+C` shortcut to start a new audio call. In Polish, `option+C` is used for letter `ć`. I changed this button combo but `Option+C` is still being blocked and doesn't allow me to write letter `ć`.
    • Zoho Books | Product updates | April 2026

      Hello users, Welcome to our April 2026 product updates roundup! Highlights include profit margin for sales transactions, insights in reports, recording deposits from undeposited funds in banking, and faster production workflows with improved assembly
    • Need Easy Way to Update Item Prices in Bulk

      Hello Everyone, In Zoho Books, updating selling prices is taking too much time. Right now we have to either edit items one by one or do Excel export/import. It will be very useful if Zoho gives a simple option to: Select multiple items and update prices
    • What is the maximum length/size of a presentation on Apple TV?

      Hello, I have a presentation here that I regularly show on Apple TV. It’s always the same presentation, which keeps getting longer and more extensive over time. Almost every slide contains a graphic or photo that takes up the entire slide. That means:
    • Items Landed Cost and Profit?

      Hello, we recently went live with Zoho Inventory, and I have a question about the Landed Cost feature. The FAQ reads: "Tracking the landed cost helps determine the overall cost incurred in procuring the product. This, in turn, helps you to decide the
    • How to set custom Sales Order numbers

      I am trying to create Sales Orders with data from Jotform submissions. Auto number generation is disabled within Books. Whereas the flow Input recognizes the number (40732 in this example), the Output does not. How can I fix this? I'd like the number
    • Differences - Blueprint vs. Approval Process

      Cannot seem to get my head around the key differences between the Blueprints and the Approval Process. For me it seems like different flavours of more or less the same thing - especially now that we have the option of Record Locking. Have a quote to sales
    • Displaying Rate Inclusive of GST per unit

      Hello, Currently when I enter the pricing of a line item it shows the overall amount (price including tax * quantity). I would like to see price/unit inclusive of GST. Is there any way to simplify this and to be able to view it? I've attached my current
    • RouteIQ user Licensefor Non–Zoho One User

      Zoho RouteIQ needs to be purchased for Zoho CRM. The current setup uses the Zoho One plan, but RouteIQ is required for a different user who is not part of Zoho One. However, they need access to routes and customer details within RouteIQ for planning their
    • Zoho Flow not handling Boolean properly

      Hi, I have a checkbox in one system that I'm trying to sync with a checkbox in Zoho CRM. The value from the source system comes in as blank (unticked) or 1 (ticked). I've written the following custom function to convert the output to either boolean false
    • Set Default Status of Assembly to "Assembled" When Entered in UI

      I've just discovered the new "confirmed" status of Assemblies within Inventory. While I understand the intent of this (allowing for manufacturing planning and raw material stock allocation), it was initially confusing to me when manually entering some
    • Introducing the New Applications Module

      We're excited to introduce the Applications module, a powerful new feature designed to revolutionize how you manage job applications. This module offers a more streamlined, efficient approach to tracking and processing candidates throughout your recruitment
    • Zoho Browser??

      hai guys, this sounds awkward but can v get a ZOHO BROWSER same as zoho writer, etc. where i can browse websites @ home and continue browsing the same websites @ my office, as v have the option in Firefox, once i save and close the browser and again when i open it i will be getting the same sites. If u people r not clear with my explanation, plz let me know. Thanks, Sandeep  
    • since the new interface of ZOHO writer can't turn of automatic reminder option for merge documents

      Since the new interface of ZOHO writer I have this problem. I have a large set of templates that I use to send documents to ZOHO Sign. But now in all those templates the box for Sending reminders is ticked, which i don't want. But even if I untick the
    • Sales Allowed Beyond Available Stock and Payment Recorded Without Restriction

      Hi, While testing in Zoho Inventory, I noticed that a sales order can be created with a quantity exceeding the available stock in the selected warehouse. In my case: Available stock: 5 units Ordered quantity: 6 units Despite this: I was able to convert
    • Function #25: Automatically generate purchase orders from a sales order

      We kicked off the "Function Fridays" series with the goal of helping you automate your everyday accounting tasks. As we delve into today's post, I'm delighted to announce that we're here to present the 25th custom function in this series. While it is
    • Next Page