Choose where you’d like to start

Fetch record by ID

Overview

This task is used to fetch a record from Zoho Books using the record ID.

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

Syntax

<variable> = zoho.books.getRecordsByID(<module_name>, <org_ID>, <record_id>, <connection>);
ParamsData TypeDescription

<variable>

KEY-VALUE

Variable to hold the response returned by Zoho Books.

<module_name>

TEXT

specifies the Zoho Books' module from which the record will be fetched.

The applicable module names can be found in the "Request Example" section in Zoho Books API -> <Module> -> Get <ModuleName> 

<org_ID>

TEXT

specifies the organization ID of the organization from which the record will be fetched.

<record_ID>

TEXT

ID of the record which will be fetched.

Learn how to fetch the ID of a record after creating it or fetching it.

<connection>

 

TEXT

is the 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> -> Get <ModuleName>. 
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

Example

The following script fetches a record from the Zoho Books module - Contacts module in Zoho Books based on the specified record id.

response = zoho.books.getRecordsById("Contacts", "5379XXXX", "XXXXXXXXXXXX92275", "books_connection");

where,

response
is the KEY-VALUE response returned by Zoho Books
"Contacts"
is the TEXT that represents the module from which the record needs to be fetched
"5379XXXX"
is the TEXT that represents the organization ID of the Zoho Books account from which the record needs to be fetched
"XXXXXXXXXXXX92275"
is the TEXT that represents the ID of the record which needs to be fetched
"books_connection"
is the TEXT that represents the Zoho Books connection

Sample Response

  • The success response returned is of the following format:

    {  
       "code":0,
       "contact":{  
          "is_crm_customer":false,
          "addresses":[  

          ],
          "notes":"",
          "documents":[  

          ],
          "owner_id":"",
          "is_linked_with_zohocrm":false,
          "is_client_review_settings_enabled":false,
          "pan_no":"",
          "billing_address":{  
             "zip":"",
             "country":"",
             "address":"",
             "city":"",
             "phone":"",
             "address_id":"XXXXXXXXXXXX92277",
             "attention":"",
             "street2":"",
             "state":"",
             "state_code":"",
             "fax":""
          },
          "default_templates":{  
             "invoice_email_template_id":"",
             "salesorder_email_template_id":"",
             "salesorder_template_id":"",
             "creditnote_email_template_id":"",
             "creditnote_template_name":"",
             "paymentthankyou_email_template_name":"",
             "estimate_template_id":"",
             "paymentthankyou_template_id":"",
             "salesorder_email_template_name":"",
             "salesorder_template_name":"",
             "invoice_email_template_name":"",
             "creditnote_email_template_name":"",
             "invoice_template_id":"",
             "paymentthankyou_email_template_id":"",
             "invoice_template_name":"",
             "estimate_template_name":"",
             "estimate_email_template_id":"",
             "creditnote_template_id":"",
             "paymentthankyou_template_name":"",
             "estimate_email_template_name":""
          },
          "source":"api",
          "outstanding_receivable_amount_bcy":0.0,
          "language_code":"",
          "twitter":"",
          "zcrm_contact_id":"",
          "unused_credits_receivable_amount_bcy":100.0,
          "gst_no":"",
          "tax_reg_no":"",
          "contact_category":"",
          "associated_with_square":false,
          "place_of_contact":"",
          "contact_persons":[  

          ],
          "pricebook_id":"",
          "outstanding_receivable_amount":0.0,
          "gst_treatment":"",
          "created_time":"2017-02-24T12:31:14+0530",
          "owner_name":"",
          "zcrm_account_id":"",
          "custom_fields":[  

          ],
          "vat_reg_no":"",
          "unused_credits_receivable_amount":100.0,
          "has_transaction":true,
          "outstanding_payable_amount_bcy":0.0,
          "tax_id":"XXXXXXXXXXXX10079",
          "pricebook_name":"",
          "price_precision":2,
          "tags":[  

          ],
          "primary_contact_id":"",
          "country_code":"",
          "checks":[  

          ],
          "unused_credits_payable_amount_bcy":0.0,
          "company_name":"",
          "tax_treatment":"",
          "crm_owner_id":"",
          "status":"active",
          "cards":[  

          ],
          "contact_id":"XXXXXXXXXXXX92275",
          "payment_terms":0,
          "currency_code":"INR",
          "outstanding_payable_amount":0.0,
          "contact_type":"customer",
          "unused_credits_payable_amount":0.0,
          "shipping_address":{  
             "zip":"",
             "country":"",
             "address":"",
             "city":"",
             "phone":"",
             "address_id":"XXXXXXXXXXXX92279",
             "attention":"",
             "street2":"",
             "state":"",
             "state_code":"",
             "fax":""
          },
          "contact_name":"updated24-Feb-2017 123114",
          "website":"",
          "is_client_review_asked":false,
          "last_modified_time":"2017-02-24T12:31:18+0530",
          "language_code_formatted":"",
          "currency_symbol":"Rs.",
          "ach_supported":false,
          "facebook":"",
          "tax_name":"GST12",
          "vendor_portal_url":"",
          "unused_retainer_payments":0.0,
          "contact_salutation":"",
          "tax_percentage":12.0,
          "bank_accounts":[  

          ],
          "currency_id":"XXXXXXXXXXXX00099",
          "is_taxable":true,
          "payment_terms_label":"Due On Receipt",
          "payment_reminder_enabled":true
       },
       "instrumentation":{  
          "query_execution_time":359,
          "response_write_time":260,
          "page_context_write_time":0,
          "request_handling_time":191
       },
       "message":"success"
    }

  • The failure response returned due to incorrect record id is of the following format:
              {  
                 "code":1002,
                 "message":"Contact does not exist."
              }
  • The failure response returned due to incorrect org id is of the following format:
              {  
                 "code":6041,
                 "message": "This user is not associated with the CompanyID/CompanyName:537XX."
             }

Related Links

Get Started Now

Execute