Update Records in Zoho Books

Table of Contents

 Overview

Using zoho.books.updateRecord() Deluge task in Zoho Creator, you can update records in Zoho Books. You can make use of different workflow options in Zoho Creator to automate this process . Update records in contacts, invoices and payments modules of Zoho Books, as and when you need to, using this taskFor example, execute "form actions" in Zoho Creator to update a contact in Zoho Books or configure a scheduler in Zoho Creator to update an invoice in Zoho Books.

 Supported Modules

  • Contacts
  • Invoices
  • Customerpayments
  • Items
  • Estimates
  • RecurringInvoices
  • Expenses

 Syntax

<response> = zoho.books.updateRecord(<module>, <orgID>, <contactID>, <params>);

where,
<response> is the map variable returned as response. It contains the details of the newly created record.

<module> is the name of the Zoho Books Module where the record needs to be updated. For example, "Contacts" refers to the Contacts module. The Zoho Books modules that are supported by Creator are "Contacts", "Invoices" and "Customer Payments".

<orgID> refers to your organization ID as specified in Zoho Books. To know your organization ID, click on <YourOrganizationName> > Manage Organizations, from the top-right corner of your Zoho Books Home page.

<contactID> is the contact ID where the record needs to be updated.

<params> is the map variable that holds the key,value pairs. The map key is the label name as specified in the Zoho Books module and the map value is the field value as submitted in the ZC form. For example, "Contact Name" : input.Contact_Name . Here, "Contact Name" is the label name as specified in the Zoho Books module and "input.Contact_Name" refers to the value specified in the Contact_Name field in the Zoho Creator Form.

Note:

  • All the parameters listed above are mandatory. 

 Example

1) Update a record in Zoho books using Zoho Creator form.

In this example, a record is updated in Zoho Books' Contacts module by adding code to a Zoho Creator form. Upon submission of the form, the email address in Zoho Books' Contacts module gets updated using the data submitted. 

  • Add the following scipt in the "on Success" section of your Zoho Creator form.
response = zoho.books.updateRecord("contacts", "12345678","11111000000000001",{"email" : "john@zillum.com"});
  • Submitting the form will update the email address in your Zoho Books' Contacts module with email "john@zillum.com"

where,
contacts is the name of the Zoho Books Module where the record needs to be updated.
12345678 is a sample organization ID. Replace it with your organization ID.
11111000000000001 is the contact ID where the record needs to be updated.
"Email" is the label name as specified in the Zoho Books module. "john@zillum.com" refers to the updated value.

 Response Format

The following code for updateRecord() task,

response = zoho.books.updateRecord("contacts", "35201411","1234000000045123",{"email" : "john@zillum.com"});
info response;

yields the following response format,

{
"message":"Contact information has been saved.",
"code":0,
"contact":{
"default_templates":{
"invoice_template_id":"",
"creditnote_email_template_id":"",
"creditnote_template_name":"",
"estimate_email_template_name":"",
"estimate_template_id":"",
"estimate_email_template_id":"",
"invoice_email_template_id":"",
"estimate_template_name":"",
"creditnote_template_id":"",
"invoice_template_name":"",
"invoice_email_template_name":"",
"creditnote_email_template_name":""
},
"payment_terms":0,
"payment_terms_label":"Due On Receipt",
"contact_id":"1782000000045001",
"price_precision":2,
"has_transaction":false,
"outstanding_receivable_amount_bcy":0,
"shipping_address":{
"zip":"",
"fax":"",
"address":"",
"state":"",
"country":"",
"city":""
},
"outstanding_receivable_amount":0,
"is_crm_customer":false,
"unused_credits_payable_amount":0,
"associated_with_square":false,
"company_name":"",
"contact_name":"Zoho Creator",
"currency_symbol":"Rs.",
"currency_code":"INR",
"cards":"[]",
"tags":"[]",
"custom_fields":"[]",
"currency_id":"1782000000000099",
"pricebook_id":"",
"status":"active",
"website":"",
"is_linked_with_zohocrm":false,
"payment_reminder_enabled":true,
"primary_contact_id":"",
"outstanding_payable_amount_bcy":0,
"bank_accounts":"[]",
"pricebook_name":"",
"source":"api",
"outstanding_payable_amount":0,
"unused_credits_receivable_amount":0,
"last_modified_time":"2015-02-18T15:01:39+0530",
"unused_credits_payable_amount_bcy":0,
"contact_persons":"[]",
"contact_salutation":"",
"contact_type":"none",
"created_time":"2015-02-18T15:01:39+0530",
"notes":"",
"billing_address":{
"zip":"",
"fax":"",
"address":"",
"state":"",
"country":"",
"city":""
},
"unused_credits_receivable_amount_bcy":0
}
}

If for some reason, the execution fails, the error response will be in the following format:

Error Response for - Wrong value for record id

{"message":"Contact does not exist.","code":1002}