Function #37: Create a Purchase Order from a Quote

Function #37: Create a Purchase Order from a Quote



Welcome back everyone!

Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote.

Business scenario:

In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order, the actual transaction, transaction confirmation, etc also need to be documented. Zoho CRM provides you different modules specific to the business process. For instance, Deals module is for Negotiation, Quotes is for finalizing an agreement, Purchase Order is for customers to place orders for procurement of products or services and Sales Order is for confirmation of the transaction.

Going by the usual business process, negotiation comes first, followed by setting up an agreement and then the customer placing an order. In other words, you need to create a deal, quote and then a purchase order. Repeating the same procedure for many leads takes up a lot of your time.

What if you can save that time by making the record creation automated? Of course, you can still have a certain degree of control. For example, you can set a button to create a Purchase Order with information from a quote. Wouldn't that make your life simpler and save time?

Getting started with the custom function:
  1. Go to Setup > Customization > Modules > Deals > Links and buttons > Create new button.
  2. Provide a name for the button. For example: "PO from Quote". Add a description(optional).
  3. Select the placement of the button as View page.
  4. Select the action to be performed as "Writing function".
  5. Copy the code given below.
  6. Click “Edit arguments”.
  7. Enter the name as “quote” and select the value as “Quote Id”.
  8. Click Save&Execute Script.
  9. Save the script.
  10. Select the profiles who can view this button.
  11. Click Save.
The Code:

respMap = zoho.crm._getRecordById("Quotes", input.quoteId.toLong());
productDet=ifnull(respMap.get("product"),"");
productList=productDet.toJSONList();
pdlist=List();
for each eachProd in productList
{
eachProdDet=eachProd.toMap();
productDesc=ifnull(eachProdDet.get("Product Description"),"");
quantity=ifnull(eachProdDet.get("Quantity"),"0");
listPrice=(ifnull(eachProdDet.get("List Price"),"0.0")).toDecimal();
netTotal=(ifnull(eachProdDet.get("Net Total"),"0.0")).toDecimal();
linediscount=(ifnull(eachProdDet.get(("Discount")),"0.0")).toDecimal();
total=(ifnull(eachProdDet.get("Total"),"0.0")).toDecimal();
productId=ifnull(eachProdDet.get("Product Id"),"");
linetax=(ifnull(eachProdDet.get("Tax"),"")).toDecimal();
mp=map();
mp.put("Product Id",productId);
mp.put("Quantity",quantity);
mp.put("List Price",listPrice);
mp.put(("Discount"),linediscount);
mp.put("Total",total);
mp.put("Tax",linetax);
mp.put("Net Total",netTotal);
pdlist.add(mp);
}
paramap=map();
paramap.put("Products",pdlist);
paramap.put("Subject",ifnull(respMap.get("Subject"),""));
paramap.put("CONTACTID",ifnull(respMap.get("CONTACTID"),""));
paramap.put("Terms and Conditions",ifnull(respMap.get("Terms and Conditions"),""));
paramap.put("Description",ifnull(respMap.get("Description"),""));
paramap.put("Tax",(ifnull(respMap.get("Tax"),"0.0")).toDecimal());
paramap.put("Adjustment",(ifnull(respMap.get("Adjustment"),"0.0")).toDecimal());
paramap.put(("Discount"),(ifnull(respMap.get(("Discount")),"0.0")).toDecimal());
paramap.put("Sub Total",(ifnull(respMap.get("Sub Total"),"0.0")).toDecimal());
paramap.put("Grand Total",(ifnull(respMap.get("Grand Total"),"0.0")).toDecimal());
createResp = zoho.crm._create("PurchaseOrders", paramap);
return "PO created successfully";

Note:
  • The code is zoho.crm._getRelatedRecords for Version 1.0 of APIs.
Found this useful? Try it out and let me know how it works! If you have questions, do not hesitate to ask! Share this with your team if you find it useful. Do check out other custom functions shared in this series here.

See you all next week with another interesting custom function. Ciao!

    • Sticky Posts

    • Zoho CRM Functions 53: Automatically name your Deals during lead conversion.

      Welcome back everyone! Last week's function was about automatically updating the recent Event date in the Accounts module. This week, it's going to be about automatically giving a custom Deal name whenever a lead is converted. Business scenario Deals are the most important records in CRM. After successful prospecting, the sales cycle is followed by deal creation, follow-up, and its subsequent closure. Being a critical function of your sales cycle, it's good to follow certain best practices. One such
    • User Tips: Auto-Create Opportunity/Deal upon Quote Save (PART 1)

      Problem: We use quotes which convert to sales orders but Users / Sales Reps do not create opportunities / deals and go straight to creating a quote. This leads to poor reporting. Implementing this solution improves reporting and makes it easier for users.
    • Custom Function : Automatically send the Quote to the related contact

      Scenario: Automatically send the Quote to the related contact.  We create Quotes for customers regularly and when we want to send the quote to the customer, we have to send it manually. We can automate this, using Custom Functions. Based on a criteria, you can trigger a workflow rule and the custom function associated to the rule and automatically send the quote to customer through an email. Please note that the quote will be sent as an inline email content and not as a PDF attachment. Please follow
    • Function #50: Schedule Calls to records

      Welcome back everyone! Last week's function was about changing ownership of multiple records concurrently. This week, it's going to be about scheduling calls for records in various modules. Business scenario Calls are an integral part of most sales routines.. Sales, Management, Support, all the branches of the business structure would work in cohesion only through calls. You could say they are akin to engine oil, which is required by the engine to make all of it's components function perfectly. CRM
    • Function #37: Create a Purchase Order from a Quote

      Welcome back everyone! Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote. Business scenario: In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order,
    • Recent Topics

    • How to Update custom Fillable Fields via Zoho Contracts API

      Our requirements for populating contract from CRM requires passing values form multiple record types (Deals and itemised Related Lists, Proposals etc). The Contract extension for CRM is great, but these do seem to be beyond it's design or capability.
    • ABILITY TO LOG INTO CUSTOMER PORTAL

      I think it would be very helpful to have a button in Zoho Books to be able to see the customer portal so we can see what they see to help them navigate through the portal. Many times, the customer will call about the portal, but without visibility into
    • How to get the call recording external ID via desk API

      I have enabled phonbridge integration with Zoom Call. I am trying to access the call recording in Zoom by calling Zoom API. I have built a Desk workflow to trigger on a new call, to call a custom function. when calling the API, the response doesn't contain
    • Quoted item subform setup button missing to add back unused field. (Zoho CRM professional edition)

      With Zoho CRM professional edition, understand that we couldnt further customize subform. But i notice there is no setup button for me to add back unused field that i accidentally removed (Tax field). it doesn't appear on left panel unused field as well.
    • Article Numbers for KB articles

      Hello, I was wondering if it's possible to turn on article numbers/ part numbering for KB articles. If this is not already a feature, we'd like to request it. Frequently a solution will require multiple articles so tracking which articles are referenced
    • Introducing Assemblies and Kits in Zoho Inventory

      Hello customers, We’re excited to share a major revamp to Zoho Inventory that brings both clarity and flexibility to your inventory management experience! Presenting Assemblies and Kits We’re thrilled to introduce Assemblies and Kits, which replaces the
    • Como se guardan las imagenes que se cargan desde el Zoho Forms a Drive o Workdrive

      ¿Cómo puedo usar Zoho Flow para tomar un archivo subido en un formulario de Zoho Forms, extraer su ID de la URL y luego copiar ese archivo a una carpeta específica en Zoho WorkDrive de manera automatizada?
    • Leave request for 0 hours is registed as 24 hours

      I have configured workschedules for all my employees, so the leave request for them whould be a lot easier. In that spirit I have configured a shift from 9 to 9 with a total duration of 0 hours. When a employee fills in a leave request for lets say a
    • Seeking Business/Operations Analyst with Strong Zoho Creator Skills

      Job Title: Business/Operations Analyst-Zoho Creator Specialist Location: Kansas City, MO (On-site) Company: SkyMark Refuelers About Us: SkyMark Refuelers is a leading manufacturer based in Kansas City, known for delivering high-quality aviation fueling
    • Limit POP Downloads to Inbox?

      Hello, When I connect to and download email from my account using the POP3 protocol, it appears that it's also downloading email from my Sent mailbox. Is there any way to limit the POP downloads to Inbox emails only? Thanks!
    • Recurring Events Not Disappearing from Zoho Calendar When Canceled by Organizer

      I receive a recurring meeting invitation to my Gmail address, The event correctly appears in my Zoho Calendar, since I have Gmail calendar integrated/viewable via Zoho Mail. When the organizer cancels one occurrence, the canceled meeting does not disappear
    • How Can I change admin account Email?

      Hi, I want to change admin email address for my account (I'm using Zoho Mail). How can i do this? Thanks!
    • Free Plan mail accounts details

      In the zoho mail pricing there's a free plan that includes: FREE PLAN Up to 25 Users 5GB* /User, 25MB Attachment Limit Webmail access only. Single domain hosting. I need to make sure that I'm able to create multiple email accounts in the form of: name@domain.com
    • Can't remove old phone number from Zoho email account and add a new one?

      Every time I try to add my new number it supposedly sends me a code which I never get and I still don't know how to remove the old number.
    • Many Deals to one Contact - Syncing issue

      Hi, In our CRM we have multiple deals to a contact. We have a field in deals called "Contract Type" - sometimes they are "business" and sometimes they are "personal" deals. I want to be able to send different emails to contacts depending on this field.
    • Unlock More Power with Zoho CRM's Enhanced Saved Filter Limit

      Dear Customers, We're happy to share some wonderful news for our valued users in the Enterprise and above editions of Zoho CRM. You must already be aware of the "saved filters" feature in Zoho CRM. Saved filters are custom search criteria that you can
    • Open a popup window from inside Record A and stay on the record after saving Record B

      Hello community, Perhaps you can help me with the following topic. I have a form A with a decision box. When this decision box is checked, a form B pops up. Once Form B is saved, I need to stay on Form A to continue entering data. I've observed the following
    • How to integrate single-sign-on using Linkedin in Zoho Creator

      How to integrate single-sign-on using LinkedIn in Zoho Creator need step by step integration.
    • Stage-Probability Mapping

      How do I answer this question in analytics? What is the Closed-Won percentage of all Deals that reach a given stage? Another way: Of all Deals that reach a given stage (eg. Artwork/Price Quote), what percentage of them become Closed-Won? I want to populate
    • Generate a Zoho Sign link

      From time to time I get a response "I never received your you e-document for electronic signature" is there a way to generate a Zoho Sign link to share.
    • What’s New in Zoho Expense: January - March 2025

      Hello users, We're excited to bring you the latest updates and improvements we've made to make your travel and expense management smoother and more effortless. Let's take a quick look at the important updates we've rolled-out in Zoho Expense between January
    • Ask the Experts 19: Live Expert Panel Discussion - Inside Zoho Desk Spring Release 2025

      Hello again! Have you ever needed quick insights into key indicators to help manage and streamline specific operations? Have you started using AI to enhance your customer service in Zoho Desk? From configuring simple bots using Guided Conversations to
    • Onboarding Zoho sign documents?

      I was wondering something about using the Zoho sign integration with the candidate onboarding process. We set up the entire onboarding process and we have added documents that the candidate needs to review and sign digitally using Zoho Sign. This part
    • Creating a whatsapp channel in instant messaging in zoho desk - error Oops, something went wrong. Please try again later.

      Creating a whatsapp channel in instant messaging in zoho desk - error Oops, something went wrong. Please try again later.
    • DKIM record Missing

      zoho says 'DKIM record missing' at the zohomail spf and dkim validation page. dkim record is most certainly in the wix dns settings. anyone had this issue?
    • zohomail - sending faxes via email using thexxxxxx@faxage.com format

      anyone doing this? zohomail - sending faxes via email using thexxxxxx@faxage.com format we do every so often send faxes using faxage.com
    • Permissions on Views

      Having the option of any agent creating custom views is firing back and got a situation where there are a hundred different views across the team and tickets are not being dealt in the most efficient of ways.  Tickets seems to be missed by some agents, whislt others have customized their columns in a way that due dates are not visible and not being respected. There needs to be control on this function in order to have a standard set of views and the ability to prevent users from performing customizations
    • Looking to Hire: Zoho Creator Developer for Vendor Dashboard Portal

      We are a Florida-based licensed liquor distributor using Zoho Books, Inventory, CRM, and Analytics. Many of our vendors are also our customers. We’re looking to build a centralized, secure Vendor Dashboard Portal in Zoho Creator that gives access to real-time
    • What is Resolution Time in Business Hours

      HI, What is the formula used to find the total time spent by an agent on a particular ticket? How is Resolution Time in Business Hours calculated in Zohodesk? As we need to find out the time spent on the ticket's solution by an agent we seek your assistance
    • Repeating Images in Emails

      Some emails have images that are repeated when viewed both on the web client (mail.zoho.com) and when using the Zoho Mail android app. It looks like perhaps some of the email styling is being ignored or applied incorrectly, as a brief inspection of the
    • Why ZOHO Function Can't Read Custom Field API In Quotes Module (Subform)

      I’m using a Deluge function to transfer data from a subform in the Quotes module to a subform in the Accounts module. Everything works except for a custom picklist field in Quotes—no matter what I try, the Zoho API can’t read that field ("Status_sb").
    • Can we customize the default client-facing icons?

      Is there any way to customize the client-facing icons that display in the Zoho Bookings UI?  For example, I'm using the Default page theme and would like to modify the default icon that is shown beside "Service."  The icon currently being shown looks like a baseball hat to me (see attached screenshot) which has no relevance to my business or clients. It would be great if Zoho could provide a different, more generic icon (perhaps a bell icon to represent service?) or better yet allow the icons to
    • Quick Create needs Client Script support

      As per the title. We need client scripts to apply at a Quick Create level. We enforce logic on the form to ensure data quality, automate field values, etc. However, all this is lost when a user attempts a "Quick Create". It is disappointing because, from
    • How to change the default module A"leads" to customised module "abc" in Zoho while integrating the leads from Skrapp!

      How to change the default module A"leads" to customised module "abc" in Zoho while integrating the leads from Skrapp!
    • Zoho Finance Limitations 2.0 #15: You can't filter any Sales Orders by their SubStatus in CRM or Analytics.

      All our sales orders move through various stages and it's nice when you can filter by open orders in "50% Building"  or "100% - Built" however this is not possible in CRM finance. It's a basic feature within native CRM using a picklist. My go to was Analytics,
    • Zoho Payroll's USA and KSA editions are available in Zoho One!

      Greetings! We’re excited to share that Zoho Payroll, currently available only in India and the UAE, is now introducing the KSA (Kingdom of Saudi Arabia) edition and the USA (United States of America) edition, and these editions are now available in Zoho
    • Zoho CRM Forecast - Exclude certain Deals

      We have our forecast and we use it for team forecast/targets/attainment. It works great for that. However, occassionally we have to offer Deals that are non-revenue generating, but are tracked in our CRM. They still have revenue tied to them, but our
    • Por que utilizar o Zoho Creator 6?

      No cenário atual, as empresas enfrentam o desafio constante de adaptar seus processos com agilidade e eficiência. É aí que entra o Zoho Creator 6, a mais recente versão da poderosa plataforma low-code da Zoho — e no nosso novo vídeo, mostramos exatamente
    • Bigin iOS app update - Introducing Card Scanner and initiating WhatsApp conversations using pre-approved templates.

      Hello everyone! In the latest iOS (v1.11.3) version of the Bigin app, we have introduced the following features: Card Scanner Initiating WhatsApp conversations. Card Scanner: Our new Card Scanner feature extracts contact information from business cards.
    • Kaizen #154 - Dynamically Update Picklist Values in Zoho CRM Workflows

      Hello all! Welcome back to another interesting Kaizen post. Today, we will discuss how to add automatically or remove values from a picklist field using Deluge within a workflow. This post serves as a solution for the forum post. Use case The sales team
    • Next Page