Create Quotes from deals with just the click of a button!
You hit a stage in a deal when you know it would follow through. This is when you must create a Quote. which is a legal agreement between a prospect and a vendor. Wouldn't it be cool to add a button to the deals module to automatically create a Quote from within the deal, on just a click of a button? Create a Quote at any stage of the deal and associate with the Quote, and save time!
Besides, the quote has the product details specific to the deal, leading to a simultaneously updated inventory as well. Two birds with one stone and all that :&41;
Getting started with the function:
- Go to Setup > Customization > Modules > Deals > Links and buttons > Create new button.
- Provide a name for the button. For example: "Create Quote from deal". Add a description(optional).
- Select the placement of the button as View page.
- Select the action to be performed as "Writing function".
- Copy the code given below.
- Click "Edit arguments".
- Enter the name as "potId" and select the value as "Potential Id".
- Click Save & Execute Script.
- Save the changes.
- Select the profiles who can view this button.
- Click Save.
potIdStr = input.potId.toString();
potDetails = zoho.crm._getRecordById("Potentials", input.potId.toLong());
RelatedProducts = zoho.crm._getRelatedRecords("Products", "Potentials", potIdStr);
quotesubject = ifnull(potDetails.get("Potential Name"),"");
contact = ifnull(potDetails.get("CONTACTID"),"");
account = ifnull(potDetails.get("ACCOUNTID"),"");
description = ifnull(potDetails.get("Description"),"");
pdlist = List();
sub = 0.0;
for each eachProd in RelatedProducts
productDesc = ifnull(eachProd.get("Product Description"),"");
quantity = 1;
productId = ifnull(eachProd.get("PRODUCTID"),"");
price = (ifnull(eachProd.get("Unit Price"),"0.0")).toDecimal();
listprice = (price * quantity);
mp = map();
mp.put("Product Id", productId);
mp.put("List Price", listprice);
mp.put("Net Total", listprice);
sub = (sub + listprice);
paramap = map();
paramap.put("POTENTIALID", input. potId);
paramap.put("Sub Total", sub);
paramap.put("Grand Total", sub);
createResp = zoho.crm._create("Quotes", paramap);
newid = createResp.get("Id");
openUrl( "https://crm.zoho.com/crm/EntityInfo.do?module=Quotes&id="+newid, "same window");
return "Quote Created";
- The code is zoho.crm._getRecordById for Version 1.0 of APIs and it is zoho.crm.getRecordById for V2 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!
← Return to Tips