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
    • 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,
    • Function-2: Round-Robin assignment of records

      Welcome back folks! Last week, we saw how to update sales commission in quotes using a custom function. This week, let's see an interesting use case asked by many of you - auto-assignment records by round-robin method. Business scenario: Right now, the solution allows you to auto-assign leads from web form and imported lists. Let us look at a need where you want to auto-assign leads from in-bound calls in a round-robin method, across modules. Prerequisite: You must create a permanent record in the
    • Recent Topics

    • Which WhatsApp API works seamlessly with Zoho CRM?

      I’m exploring WhatsApp API solutions that integrate seamlessly with Zoho CRM for customer communication, lead nurturing, and automation. I would love to hear insights from those who have successfully implemented WhatsApp within Zoho CRM. My Requirements:
    • "Fail to update" error in Zoho Notebook

      I am getting a "fail to update" error repeatedly in Notebook when I try to update one of my existing notes with a screenshot.  Are there limitations on how large a note can be or what can be included in a file? 
    • Zeptomail 136.143.188.150 blocked by SpamCop

      Hi - it looks like this IP is being blocked, resulting in hard bounces unfortunately :( "Reason: uncategorized-bounceMessage: 5.7.1 Service unavailable; Client host [136.143.188.150] blocked using bl.spamcop.net; Blocked - see https://www.spamcop.net/bl.shtml?136.143.188.150
    • Multi-line address lines

      How can I enter and migrate the following 123 state street Suite 2 Into a contact address. For Salesforce imports, a CR between the information works. The ZOHO migration tool just ignores it. Plus, I can't seem to even enter it on the standard entry screen.
    • Weekly Tips: SecurePass For Extra Security

      Imagine sensitive data from your organisation sent via email is being accessed by unintended recipients. The sensitive data can range from Personal Identification Information to a tender quotation or a client’s NDA document. The unintended access could
    • Job Opening Fields - Rich Text

      I migrated to the new version (4?) of ZoHo Recruit.  I am trying to add a new field to my Job Openings layout and I want it to be a rich text field (just like the field I am typing in right now) so I can format the text, instead of just entering plain text.  I know the rich text field exists because one of my existing fields (Job Description) migrated over as a rich text field.  But I don't see rich text as a choice in the field type menu.  Or, I would like to change the field type on an existing
    • Cross-Posting to a Telegram Channel

      We don't have a native way to cross-post to Telegram channels. Did anyone find a way around it? I checked Zoho Flow - but Telegram isn't there. Maybe some 3rd party integrations connecting Facebook, IG, etc., bypassing SalesIQ altogether?
    • Deals sync for Campaigns or Marketing Automation...

      We are looking to create a marketing campaign based on a custom "expiration date" field inside our DEALS module. We are open to using either CAMPAIGNS or MARKETING AUTOMATION but haven't been able to get either platform to sync the specific fields we
    • Access of Activities Module in CRM to Client Portal?

      I want to enable access of Activities Module in Client Portal of my CRM to my Clients but not getting option to choose the module. By doing this I aim to give the access to the clients to their realtime status of the work going on and they can track the
    • Google ads - zoho crm integration problem

      dear zoho team we were starting to use google ads integration with zoho crm years ago.  but till April there was an error. we can see GCLID in zoho crm but we couldn't get any information from google ads. (keywords campaign name etc) is there any problem
    • User Filter for Dynamic Date Dimensions in Zoho Analytics

      One challenge I frequently encounter is the need to create multiple versions of the same report—one for yearly data, another for quarterly data, another for monthly, and so on. While this works, it leads to unnecessary duplication, making maintenance
    • Show or hide a field based on the value selected in another field?

      Can this be done in CRM? If not and can only happen in Creator is there a way to combine Creator and CRM without paying for 2 accounts?  Thanks in advance for your response(s).
    • WebDAV support

      I need WebDAV support so that I can upload/download (and modify) documents from my local file system. Is anything planned in his direction?
    • Is there a quick way to copy the contact details for a Zoho CRM contact?

      This has probably been asked lots of times before, but I couldn't find an answer anywhere - Is there a simple 'one-click' way to copy a contacts details from Zoho CRM, so that you can paste it into an email or word document? All I need is to grab 'business
    • Solution for setting up header and footer in a template

      Hi all, Emon need for business, I have long searched the forum and also how to put in my quote and my bills a header and a footer. And finally, I have an other working stream elements allowing me to meet my needs ... Given the number of people seeking the same thing as me, I say it might be good to share my discovery. It's simple and easy to implement First, start by adding the beginning of your HTML the following: <style> html {margin: 0;}  body {margin: 0;}  div # printhead { display: block;  position:
    • ZOHO Expense API Documentation - Can't see anything about Purchase Requests

      Hello, I am reading the API Documentation for Zoho Expense but can't see anything about Purchase Requests - This is one of the modules we use the most. Has anyone had any luck getting Purchase Requests data from Zoho Expense via API? Thanks,
    • KPI Widget - last month sales vs same period last year

      I would like a KPI Widget that might compare data with the following date ranges: This month to date (meaning all of February through the current date, for example the 14th, if today was the 14th. So Feb 1-14th 2018)vs. last year this month to date (Showing
    • Client Script event on any field of a Detail page

      Hi everyone! I'd like to trigger a Client Script when a user modifies a field - any field - from the Account Details page, how can I do this? I don't want to trigger it on a specific field, but on all of them. Thanks in advance!
    • GSTIN Public Search API

      Does zohobooks have an api using which i can search GST numbers and get their details?
    • Restrict Past Date in Zoho CRM Module

      How can I restrict from selecting a previous Date? I want only future dates to be selectable
    • Pushing GCLID info from Gravity Forms to ZohoCRM

      We are switching to Gravity Forms from Zoho Forms and I cannot find any good info on how to make sure my GCLID tracking info is pushed through to the CRM through my new forms. There was an article in the documentation about placing something within the
    • Add tasklist from a template to Zoho Project using Deluge

      I have some tasklist templates that I want to be able to add to a project under certain circumstances. So if a project meets Condition A, add the tasklist from Template B to that project. If it meets condition C, add tasklist from Template D, and so on.
    • 'Add Tax To Amount' not reflected in Invoice

      Hi Zoho Support, I'm experiencing an issue with tax calculation display in my invoice template. Despite having "Add tax to amount" box checked in the template settings, the Amount column is not showing the tax-inclusive total for line items. Current behaviour:
    • Enhancing self-service capabilities with AI-based Zia Answer Bot

      Hello All, Zia Answer Bot is available with better accuracy to enhance the self-service capabilities of the platform and to empower the users to resolve queries independently. By leveraging knowledge base (KB) resources, the Answer Bot provides accurate
    • Rounding off rate in quote

      Hi team, Please help me to rounding of rate amount in quote
    • Zoho Flow custom functions "Error occurred while processing this request. Contact support for more details"

      Any ideas why this is happening? Zoho Flow custom function...
    • Introducing our latest privacy enhancement - Hiding email IDs in Zoho Cliq Networks

      Hello everyone, Zoho Cliq Networks offers a powerful collaboration platform that allows businesses to create dedicated digital workspaces for external vendors, partners, or individuals you want to communicate with professionally without adding them to
    • I need to add difference for Average Row at the end

      (Confidential data hidden here) Guys, hello! I have this graph, it calculates the averages of Retention and then shows the delta (2024 - 2023). In the 3rd column with delta Churn %, I want to show the difference between averages too, which would be (16.99
    • No encuentro la opción para crear una orden de compra

      No encuentro la opción para crear una orden de compra, soy nuevo, ya busqué tutoriales, pero no me aparecen dichas opciones.
    • Post on behalf of employees as well as business socials

      Is there a way to give our sales team access to social to add their own LinkedIn accounts, so that when we schedule business posts, we can also post on behalf of them at the same time so they don't have to repost etc.
    • Alignment of Company Information Page Structure in Zoho One and Zoho Desk

      Hello Zoho One Support, We appreciate the continuous improvements across Zoho products. Recently, Zoho Desk restructured the Company Information page into three distinct sections: Company Profile – Includes Company Name, Logo, Alias, Description, Website,
    • Trying to setup a record to automatically create on a weekly basis

      Hello all, I need multiple records to be automatically created on a weekly basis. What I'm trying to accomplish is, I have a maintenance database where I track when I work on IT related systems. Every week on the same days I perform backups on systems
    • Effortlessly advance through your CRM blueprints by including optional fields in transitions

      Editions: Professional edition and above DCs: All Release plan: This enhancement is being released in a phased manner to customers. It will soon be available to all users. [Updated on 5 Sep 2024] This enhancement has been released to all users in all
    • How to merge duplicate products?

      merge duplicate products
    • How can I delete duplicate transactions?

      I want to delete the duplicates not simply exclude them. I have duplicates, because I had automatic bank feeds turned on (had to make sure this critical functionality was working before migrating to Zoho). Now when I import my csv's exported from Wave,
    • Automate posting to job site boards via Deluge/ or Schedule

      Hi Zoho Recruit Community, I'm working on automating a recurring job posting for a long-standing labor hire role that we update monthly. Right now, I can automate the creation of the job opening using scheduled tasks and Deluge scripts. However, the challenge
    • Customer Statement Template

      Hi. how can i add order number "customer LPO number" in the customer statement. regards
    • Is it possible to select the methods of inserting a signature (Not provider)

      Hi, I tried to search through the help pages and application interface trying to find if there's a way to limit the assigned signees, for example, allowing only images or drawing, and disallowing the automatic signature creator as per their name. It'll
    • How To Sync 'Deals' data To The Related Contact In The 'Contacts' Module

      Hi there! I'm looking to be able to sync Deals and Contacts. Basically, when someone places an order we have it syncing the order data to Deals, complete with the customer's name and email. Is there any way to have that Deal synced to the matching contact in the Contacts module? Presumably matching by email address. I'm familiar with Workflows, however it doesn't seem that Workflows work across different modules. We're looking to be able to run reports based on what the customer bought, but can't
    • Zoho CRM Appointments and Services

      The Appointments and Services modules are nice but very limited. Is there any chance that Zoho will make these more customizable or expand the fuctionality? Appointments Allow "Appointment For" lookup to the Deals module. For us and I'm guessing others
    • Next Page