Get Templates From Zoho Books

Note:

  • Each time the zoho.books.getTemplates integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
  • Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.books.getTemplates integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script. 

Overview

This task is used to fetch all the templates from the specified Zoho Books module.

This task is based on Zoho Books API -> <Module> -> List <ModuleName> templates.

Syntax

<variable> = zoho.books.getTemplates(<module_name>, <org_ID>, <connection>);
ParamsData typeDescription
<variable>KEY-VALUEVariable which will hold the response returned by Zoho Books.
<module_name>TEXT

specifies the module from which the templates will be fetched.

Following are the applicable modules.

InvoicesSalesordersRetainerInvoices
EstimatesPurchaseordersCreditNotes
<org_ID>TEXTspecifies the organization ID of the account from which the templates will be fetched.
<connection>TEXT

is the link name of the Zoho Books connection

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter unless the authtoken is manually deleted from accounts.
  • Add relevant scopes as mentioned in Zoho Books API -> <Module> -> List <ModuleName> templates.
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

Example

The following script fetches all the templates from the Zoho Books module - Invoices.

 response = zoho.books.getTemplates("Invoices","5379XXXX", "books_connection");

where,

response
is the variable which will hold the KEY-VALUE response returned by Zoho Books
"Invoices"
is the TEXT that represents the name of the module from which the templates need to be fetched
"5379XXXX"
is the TEXT that represents the organization ID of the Zoho Books account
"books_connection"
is the TEXT that represents Zoho Books connection

Response Format

  • The following is a sample success response:

      {
      "code":0,
      "message":"success",
      "templates":[
      {
      "template_name":"Spreadsheet Template",
      "template_id":"176XXXXXXXXXXXXX108",
      "template_type":"excel"
      },
      {
      "template_name":"Standard Template",
      "template_id":"176XXXXXXXXXXXXX001",
      "template_type":"standard"
      }
      ]
      }
  • The failure response returned for incorrect / non-existent organization ID is of the following format.

      {
      "code":6041,
      "message":"This user is not associated with the CompanyID/CompanyName:638XXX318."
      }

Related Links