For Zoho services only


I'm currently part of a wider delivery team at Ascent Business Solutions, recognised as a leading Zoho Premium Solutions Partner in the United Kingdom.

Ascent Business Solutions support organisations with everything from targeted technical fixes through to full Zoho CRM implementations and long-term platform adoption. Working as a team rather than a one-person consultancy allows projects to move forward consistently, with access to the right skills at each stage.

The team I manage specialises in API integrations between Zoho and third-party finance and commerce platforms such as Xero, Shopify, WooCommerce, and eBay. Much of our work involves solving integration challenges that fall outside standard documentation, supporting new ideas, new sectors, and evolving business models.

Success is measured through practical outcomes and return on investment, ranging from scaling small operations into high-turnover businesses to delivering rapid gains through online payments, automation, and streamlined digital workflows.

If you are looking for structured Zoho expertise backed by an established consultancy, you can contact Ascent Business Solutions on 0121 392 8140 (UK), email info@ascentbusiness.co.uk, or visit https://www.ascentbusiness.co.uk.
Zoho CRM: Client Script: Swap Quote Account with Deal Lookup

Zoho CRM: Client Script: Swap Quote Account with Deal Lookup

What?
A very quick article on a small client script to set the Account field on the Quote from a lookup field on the Deal record.

Why?
The use-case here is that I have a client who is a supplier. The opportunity (aka Deal) will be in the end customer's name so it is their name in the Account field. When a quote is raised off the opportunity, the quote needs to be targeted to the distributor/reseller but if you click on the Add New Quote from the opportunity record, it puts the end customer in the Account field (maps Deal Account Name to Quote Account Name).

How?
We want this to happen as soon as a CRM user clicks on the plus symbol or "Add New" in the quotes related list section of the Deal record. In this example, on the Deal/Opportunity record, I have an Account Name field (the end customer), and a "Distributor" (lookup to the Accounts) as well as a "Reseller" (another lookup to Accounts) field. EITHER the Distributor or Reseller field will be populated but this will be the company the quote should be raised for.

Setup up the Client Script:
  1. Login to ZohoCRM > Setup (cog icon next to profile photo) > Developer Hub > Client Script > New Script
  2. Give it a name, I'm calling mine Quotes - Map Distributor/Reseller
  3. Give it a description. I said "Maps the distributor/reseller from the opportunity into the account.".
  4. Category is Module, Page is Create Page (Standard) (change this depending on if you're using a canvas or not)
  5. Module is Quotes
  6. Type is Page Event
  7. Event is onLoad
  8. Click on the button Next

The code:
copyraw
/* *******************************************************************************
	Function:       Quotes - Map Distributor/Reseller
	Label:          Quotes - Map Distributor/Reseller
	Page Details
        Category    Module
        Page        Create Page (Standard)
        Module      Quotes
        Layout      Standard
    Event Details
        Event Type  Page Event
        Event       onLoad
	Purpose:	 	Maps the distributor/reseller from the opportunity into the account.
	Inputs:         -
	Outputs:        -

	Date Created:   2026-01-20 (Joel Lipman)
					- Initial release
	Date Modified:	???
					- ???

	More Information:
					https://www.zohocrm.dev/explore/client-script/webapi/Modules#fetchById

******************************************************************************* */

var f_Opportunity = ZDK.Page.getField('Deal_Name');
var o_OpportunityLookup = f_Opportunity.getValue();

if (o_OpportunityLookup != null) {

    var v_OppID = o_OpportunityLookup.id;

    var o_OppDetails = ZDK.Apps.CRM.Deals.fetchById(o_OpportunityLookup.id);

    if (o_OppDetails._Distributor_Lookup_Id != null) {

        // get distributor record
        var o_DistDetails = ZDK.Apps.CRM.Accounts.fetchById(o_OppDetails._Distributor_Lookup_Id);

        // set quote account lookup
        var f_Account = ZDK.Page.getField('Account_Name');
        f_Account.setValue({ id: o_OppDetails._Distributor_Lookup_Id, name: o_DistDetails.Account_Name });
    }

    if (o_OppDetails._Reseller_Lookup_Id != null) {

        // get reseller record
        var o_ResellerDetails = ZDK.Apps.CRM.Accounts.fetchById(o_ResellerDetails._Reseller_Lookup_Id);

        // set quote account lookup
        var f_Account = ZDK.Page.getField('Account_Name');
        f_Account.setValue({ id: o_ResellerDetails._Reseller_Lookup_Id, name: o_ResellerDetails.Account_Name });
    }
}
  1.  /* ******************************************************************************* 
  2.      Function:       Quotes - Map Distributor/Reseller 
  3.      Label:          Quotes - Map Distributor/Reseller 
  4.      Page Details 
  5.          Category    Module 
  6.          Page        Create Page (Standard) 
  7.          Module      Quotes 
  8.          Layout      Standard 
  9.      Event Details 
  10.          Event Type  Page Event 
  11.          Event       onLoad 
  12.      Purpose:         Maps the distributor/reseller from the opportunity into the account. 
  13.      Inputs:         - 
  14.      Outputs:        - 
  15.   
  16.      Date Created:   2026-01-20 (Joel Lipman) 
  17.                      - Initial release 
  18.      Date Modified:    ??? 
  19.                      - ??? 
  20.   
  21.      More Information: 
  22.                      https://www.zohocrm.dev/explore/client-script/webapi/Modules#fetchById 
  23.   
  24.  ******************************************************************************* */ 
  25.   
  26.  var f_Opportunity = ZDK.Page.getField('Deal_Name')
  27.  var o_OpportunityLookup = f_Opportunity.getValue()
  28.   
  29.  if (o_OpportunityLookup != null) { 
  30.   
  31.      var v_OppID = o_OpportunityLookup.id; 
  32.   
  33.      var o_OppDetails = ZDK.Apps.CRM.Deals.fetchById(o_OpportunityLookup.id)
  34.   
  35.      if (o_OppDetails._Distributor_Lookup_Id != null) { 
  36.   
  37.          // get distributor record 
  38.          var o_DistDetails = ZDK.Apps.CRM.Accounts.fetchById(o_OppDetails._Distributor_Lookup_Id)
  39.   
  40.          // set quote account lookup 
  41.          var f_Account = ZDK.Page.getField('Account_Name')
  42.          f_Account.setValue({ id: o_OppDetails._Distributor_Lookup_Id, name: o_DistDetails.Account_Name })
  43.      } 
  44.   
  45.      if (o_OppDetails._Reseller_Lookup_Id != null) { 
  46.   
  47.          // get reseller record 
  48.          var o_ResellerDetails = ZDK.Apps.CRM.Accounts.fetchById(o_ResellerDetails._Reseller_Lookup_Id)
  49.   
  50.          // set quote account lookup 
  51.          var f_Account = ZDK.Page.getField('Account_Name')
  52.          f_Account.setValue({ id: o_ResellerDetails._Reseller_Lookup_Id, name: o_ResellerDetails.Account_Name })
  53.      } 
  54.  } 

Category: Zoho CRM :: Article: 1719

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com