Choose where you’d like to start

Update Records in Zoho Books

Overview

This task is used to update a record in Zoho Books using the record ID.

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

Syntax

<variable> = zoho.books.updateRecord(<module_name>, <org_ID>, <record_ID>, <data_map>, <books_connection>);

where,

ParameterData typeDescription

<variable> 

KEY-VALUE

Variable which will hold the response returned by Zoho Books.

<module_name>

TEXT

specifies the Zoho Books' module in which the record will be updated.

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

<org_ID>

TEXT

specifies the organization ID of the account in which the record will be updated.

<record_ID>

TEXT

specifies the ID of the record which will be updated.

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

<data_map>

KEY-VALUE

Map key-value pairs with key as field name in Zoho Books and value as its updated value.

To learn about the field names, click here and navigate to <ModuleName> -> Update a <ModuleName>

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

Example

The following script updates the record with ID - XXXXXXXXXXXX11003 in the Zoho Books module - Invoices.

 invoiceMap=map();
 itemList=List();
 item1=map();
 item1.put("item_id","XXXXXXXXXXXX04015");
 item1.put("rate", "500");
 item1.put("quantity", 12);
 itemList.add(item1);

 item2=map();
 item2.put("item_id","XXXXXXXXXXXX04015");
 item2.put("rate", "550");
 item2.put("quantity", 12);
 itemList.add(item2);

 invoiceMap.put("line_items", itemList);
 response= zoho.books.updateRecord("Invoices", "5379XXXX", "XXXXXXXXXXXX11003", invoiceMap, "books_connection");

where,

 item1
 item2
are the KEY-VALUE variables that hold the new values of the items
itemList
is the LIST that holds the list of all items that needs to be updated along with their new values
invoiceMap
is the KEY-VALUE variable that holds the new values of the record that needs to be updated
"Invoices"
is the TEXT that represents the module which contains the record that needs to be updated
"5379XXXX"
is the TEXT that represents the organization ID of the Zoho Books account
"XXXXXXXXXXXX11003"
is the TEXT that represents the ID of the record that needs to be updated
"books_connection"
is the TEXT that represents the Zoho Books connection

Note:

  • Records except the ones being updated will be deleted automatically.

Sample Response

  • The following is a sample success response:

    {  
       "code":0,
       "invoice":{  
          "can_send_in_mail":false,
          "zcrm_potential_id":"",
          "place_of_supply":"DL",
          "is_client_review_settings_enabled":false,
          "discount":0.0,
          "taxes":[  
             {  
                "tax_amount":756.0,
                "tax_name":"CGST6 (6%)"
             },
             {  
                "tax_amount":756.0,
                "tax_name":"SGST6 (6%)"
             }
          ],
          "billing_address":{  
             "zip":"",
             "country":"",
             "address":"",
             "city":"",
             "phone":"",
             "attention":"",
             "street2":"",
             "state":"",
             "fax":""
          },
          "line_items":[  
             {  
                "bcy_rate":500.0,
                "salesorder_item_id":"",
                "line_item_id":"XXXXXXXXXXXX11017",
                "has_product_type_mismatch":false,
                "documents":[  

                ],
                "discount_amount":0.0,
                "description":"",
                "discount":0.0,
                "gst_treatment_code":"",
                "item_order":1,
                "bill_item_id":"",
                "project_id":"",
                "rate":500.0,
                "account_name":"Sales",
                "hsn_or_sac":"",
                "bill_id":"",
                "quantity":12.0,
                "item_id":"XXXXXXXXXXXX04015",
                "expense_receipt_name":"",
                "reverse_charge_tax_id":"",
                "tax_name":"GST12",
                "item_total":6000.0,
                "item_custom_fields":[  

                ],
                "tax_id":"XXXXXXXXXXXX10079",
                "tags":[  

                ],
                "unit":"",
                "account_id":"XXXXXXXXXXXX00388",
                "product_type":"goods",
                "tax_type":"tax_group",
                "time_entry_ids":[  

                ],
                "name":"pendrive",
                "tax_percentage":12,
                "expense_id":""
             },
             {  
                "bcy_rate":550.0,
                "salesorder_item_id":"",
                "line_item_id":"XXXXXXXXXXXX11019",
                "has_product_type_mismatch":false,
                "documents":[  

                ],
                "discount_amount":0.0,
                "description":"",
                "discount":0.0,
                "gst_treatment_code":"",
                "item_order":2,
                "bill_item_id":"",
                "project_id":"",
                "rate":550.0,
                "account_name":"Sales",
                "hsn_or_sac":"",
                "bill_id":"",
                "quantity":12.0,
                "item_id":"XXXXXXXXXXXX04015",
                "expense_receipt_name":"",
                "reverse_charge_tax_id":"",
                "tax_name":"GST12",
                "item_total":6600.0,
                "item_custom_fields":[  

                ],
                "tax_id":"XXXXXXXXXXXX10079",
                "tags":[  

                ],
                "unit":"",
                "account_id":"XXXXXXXXXXXX00388",
                "product_type":"goods",
                "tax_type":"tax_group",
                "time_entry_ids":[  

                ],
                "name":"pendrive",
                "tax_percentage":12,
                "expense_id":""
             }
          ],
          "type":"invoice",
          "balance":14112.0,
          "gst_no":"",
          "terms":"",
          "credits_applied":0.0,
          "filed_in_vat_return_id":"",
          "invoice_number":"INV-000196",
          "payment_options":{  
             "payment_gateways":[  

             ]
          },
          "tax_specification":"intra",
          "debit_notes":[  

          ],
          "stop_reminder_until_payment_expected_date":false,
          "exchange_rate":1.0,
          "estimate_id":"",
          "merchant_name":"",
          "reference_number":"",
          "is_autobill_enabled":false,
          "is_pre_gst":false,
          "page_height":"11.69in",
          "status":"draft",
          "tax_total":1512.0,
          "is_viewed_by_client":false,
          "write_off_amount":0.0,
          "salesorder_id":"",
          "merchant_gst_no":"",
          "currency_code":"INR",
          "page_width":"8.27in",
          "reason_for_debit_note":"others",
          "adjustment_description":"",
          "last_modified_time":"2017-11-27T12:52:35+0530",
          "currency_symbol":"Rs.",
          "shipping_bills":[  

          ],
          "discount_type":"item_level",
          "transaction_rounding_type":"no_rounding",
          "contact_persons_details":[  

          ],
          "roundoff_value":0.0,
          "template_name":"Standard Template",
          "schedule_time":"",
          "template_id":"XXXXXXXXXXXX15001",
          "customer_name":"Bowman and Co",
          "customer_id":"XXXXXXXXXXXX04005",
          "is_taxable":true,
          "payment_terms_label":"Due On Receipt",
          "show_no_of_copies":true,
          "is_reverse_charge_applied":false,
          "date":"2017-11-08",
          "notes":"Thanks for your business.",
          "documents":[  

          ],
          "client_viewed_time":"",
          "invoice_id":"XXXXXXXXXXXX11003",
          "contact_category":"business_none",
          "template_type":"standard",
          "recurring_invoice_id":"",
          "contact_persons":[  

          ],
          "gst_treatment":"business_none",
          "created_time":"2017-11-27T12:48:40+0530",
          "is_inclusive_tax":false,
          "custom_fields":[  

          ],
          "last_payment_date":"",
          "price_precision":2,
          "payment_discount":0.0,
          "tax_treatment":"business_none",
          "zcrm_potential_name":"",
          "adjustment":0.0,
          "created_by_id":"XXXXXXXXXXXX70001",
          "next_invoice_id":"",
          "filed_in_vat_return_name":"",
          "is_discount_before_tax":true,
          "attachment_name":"",
          "ach_payment_initiated":false,
          "last_reminder_sent_date":"",
          "merchant_id":"",
          "payment_terms":0,
          "gst_return_details":{  
             "return_period":"",
             "status":""
          },
          "total":14112.0,
          "tax_amount_withheld":0.0,
          "custom_field_hash":{  

          },
          "shipping_address":{  
             "zip":"",
             "country":"",
             "address":"",
             "city":"",
             "phone":"",
             "attention":"",
             "street2":"",
             "state":"",
             "fax":""
          },
          "next_reminder_date_formatted":"",
          "orientation":"portrait",
          "discount_applied_on_amount":0.0,
          "due_date":"2017-11-08",
          "no_of_copies":1,
          "reverse_charge_tax_total":0.0,
          "payment_expected_date":"",
          "unused_retainer_payments":0.0,
          "is_emailed":false,
          "reminders_sent":0,
          "salesperson_name":"",
          "filed_in_vat_return_type":"",
          "salesperson_id":"",
          "shipping_charge":0.0,
          "payment_made":0.0,
          "sub_total":12600.0,
          "allow_partial_payments":false,
          "currency_id":"XXXXXXXXXXXX00099",
          "invoice_url":"https://books.zoho.com/portal/delugeteam/secure?CInvoiceID=2-49a6c2d4b62b5a07afeXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX5dfbe6dd0dc765e48cdc51d8ddc5526b9 ",
          "payment_reminder_enabled":true
       },
       "instrumentation":{  
          "query_execution_time":438,
          "response_write_time":231,
          "page_context_write_time":0,
          "request_handling_time":1668
       },
       "message":"Invoice information has been updated."
    }

  • The failure response returned due to incorrect record id is of the following format:
              {  
                 "code":-1,
                 "message":"Resource 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:53792."
             }

Related Links

Get Started Now

Execute