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 & Zoho Books: Get Books Currency and Tax IDs

Zoho CRM & Zoho Books: Get Books Currency and Tax IDs

What?
A quick note for when I want to quickly generate maps of a currency or a tax from a client's Zoho Books.

Why?
The use-case here is that we are creating a Sales Order in Zoho Books from Zoho CRM and want to map the correct currency and tax by their ID numbers.

How?
Using the REST API and InvokeURL in Zoho Deluge to look at Zoho Books. This uses up an extra 2 calls so you could run them once, store them as a map on your function if you don't want to use up these 2 every time your sales team push a CRM Sales Order to Zoho Books. Or leave as 2 calls at the beginning of your function in case they add a currency or tax rate and want to push a sales order immediately over.

Get Currencies
Remember to replace the v_BooksOrgID with your client's Organization ID for Zoho Books and check the URL for whether it will be https://books.zoho.eu or https://books.zoho.com. You will also need your own CRM to Books connection name (joel_books) with scope to read settings:
copyraw
// our made up books org id but enter your own
v_BooksOrgID=20210924095;
//
// get currencies
m_Currencies = Map();
r_Currencies = invokeurl
[
	url :"https://books.zoho.eu/api/v3/settings/currencies?organization_id=" + v_BooksOrgID
	type :GET
	connection:"joel_books"
];
for each  r_Currency in r_Currencies.get("currencies")
{
	m_Currencies.put(r_Currency.get("currency_code"),r_Currency.get("currency_id"));
}
info m_Currencies;
//
// get Books ID for a currency from an CRM account record
r_AccountDetails = zoho.crm.getRecordByID("Accounts", 9012345678901234567);
v_BooksCurrencyID = m_Currencies.get(ifnull(r_AccountDetails.get("Currency"),"GBP"));
info v_BooksCurrencyID;
  1.  // our made up books org id but enter your own 
  2.  v_BooksOrgID=20210924095
  3.  // 
  4.  // get currencies 
  5.  m_Currencies = Map()
  6.  r_Currencies = invokeurl 
  7.  [ 
  8.      url :"https://books.zoho.eu/api/v3/settings/currencies?organization_id=" + v_BooksOrgID 
  9.      type :GET 
  10.      connection:"joel_books" 
  11.  ]
  12.  for each  r_Currency in r_Currencies.get("currencies") 
  13.  { 
  14.      m_Currencies.put(r_Currency.get("currency_code"),r_Currency.get("currency_id"))
  15.  } 
  16.  info m_Currencies; 
  17.  // 
  18.  // get Books ID for a currency from an CRM account record 
  19.  r_AccountDetails = zoho.crm.getRecordByID("Accounts", 9012345678901234567)
  20.  v_BooksCurrencyID = m_Currencies.get(ifnull(r_AccountDetails.get("Currency"),"GBP"))
  21.  info v_BooksCurrencyID; 
Yields something like:
copyraw
{
  "EUR": "123456789012345678",
  "GBP": "234567890123456789",
  "USD": "345678901234567890",
}

234567890123456789
  1.  { 
  2.    "EUR": "123456789012345678", 
  3.    "GBP": "234567890123456789", 
  4.    "USD": "345678901234567890", 
  5.  } 
  6.   
  7.  234567890123456789 


Get Taxes
Same as above but to get the tax rates and their IDs:
copyraw
// our made up books org id but enter your own
v_BooksOrgID=20210924095;
//
// get taxes
m_Taxes = Map();
r_Taxes = invokeUrl
[
	url: "https://books.zoho.eu/api/v3/settings/taxes?organization_id="+v_BooksOrgID
	type: GET
	connection: "joel_books"
];
for each r_Tax in r_Taxes.get("taxes")
{
	m_Taxes.put(r_Tax.get("tax_percentage").toString(), r_Tax.get("tax_id"));
}
info m_Taxes;
//
// set Tax ID for a sales order line item
l_LineItems = List();
r_SoDetails = zoho.crm.getRecordById("Sales_Orders",0123456789012345678);
for each  r_LineItem in r_SoDetails.get("Product_Details")
{
	m_LineItem = Map();
	if(r_LineItem.get("Tax") > 0)
	{
		for each r_LineTax in r_LineItem.get("line_tax")
		{
			if(r_LineTax.get("percentage") > 0)
			{
				v_BooksTaxID = ifnull(m_Taxes.get(r_LineTax.get("percentage")),678901234567890123);
				m_LineItem.put("tax_id",v_BooksTaxID);
				m_LineItem.put("tax_percentage",r_LineTax.get("percentage"));
			}
		}
	}
	l_LineItems.add(m_LineItem);
}
info v_BooksTaxID;
  1.  // our made up books org id but enter your own 
  2.  v_BooksOrgID=20210924095
  3.  // 
  4.  // get taxes 
  5.  m_Taxes = Map()
  6.  r_Taxes = invokeUrl 
  7.  [ 
  8.      url: "https://books.zoho.eu/api/v3/settings/taxes?organization_id="+v_BooksOrgID 
  9.      type: GET 
  10.      connection: "joel_books" 
  11.  ]
  12.  for each r_Tax in r_Taxes.get("taxes") 
  13.  { 
  14.      m_Taxes.put(r_Tax.get("tax_percentage").toString(), r_Tax.get("tax_id"))
  15.  } 
  16.  info m_Taxes; 
  17.  // 
  18.  // set Tax ID for a sales order line item 
  19.  l_LineItems = List()
  20.  r_SoDetails = zoho.crm.getRecordById("Sales_Orders",0123456789012345678)
  21.  for each  r_LineItem in r_SoDetails.get("Product_Details") 
  22.  { 
  23.      m_LineItem = Map()
  24.      if(r_LineItem.get("Tax") > 0) 
  25.      { 
  26.          for each r_LineTax in r_LineItem.get("line_tax") 
  27.          { 
  28.              if(r_LineTax.get("percentage") > 0) 
  29.              { 
  30.                  v_BooksTaxID = ifnull(m_Taxes.get(r_LineTax.get("percentage")),678901234567890123)
  31.                  m_LineItem.put("tax_id",v_BooksTaxID)
  32.                  m_LineItem.put("tax_percentage",r_LineTax.get("percentage"))
  33.              } 
  34.          } 
  35.      } 
  36.      l_LineItems.add(m_LineItem)
  37.  } 
  38.  info v_BooksTaxID; 
Yields something like:
copyraw
{
  "0": "456789012345678901",
  "5": "567890123456789012",
  "20": "678901234567890123",
}

678901234567890123
  1.  { 
  2.    "0": "456789012345678901", 
  3.    "5": "567890123456789012", 
  4.    "20": "678901234567890123", 
  5.  } 
  6.   
  7.  678901234567890123 

For CRM REST API:
copyraw
r_TaxRates = invokeUrl
[
	url: "https://www.zohoapis.com/crm/v6/org/taxes"
	type: GET
	connection: "zcrm"
];
info r_TaxRates;

// list taxes
l_Taxes = ifnull(r_TaxRates.get("org_taxes").get("taxes"),List());
  1.  r_TaxRates = invokeUrl 
  2.  [ 
  3.      url: "https://www.zohoapis.com/crm/v6/org/taxes" 
  4.      type: GET 
  5.      connection: "zcrm" 
  6.  ]
  7.  info r_TaxRates; 
  8.   
  9.  // list taxes 
  10.  l_Taxes = ifnull(r_TaxRates.get("org_taxes").get("taxes"),List())

Category: Zoho Books :: Article: 309

Joes Word Cloud

calls   https   function   each   case   them   made   taxes   push   sales   currencies   joel   info   booksorgid   rest   books   settings   their   client   connection   your   currency   type   invokeurl   taxrates   want   order   zoho   enter   will   JoelLipman.Com

Accreditation

Badge - Zoho Creator Certified Developer Associate
Badge - Zoho Deluge Certified Developer
Badge - Certified Zoho CRM Developer

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF

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