Deluge Help

Update Records in Zoho Invoice

 Overview

The zoho.invoice.update()task can be executed to update existing record in any of the supported modules of Zoho Invoice. By placing it in the required workflow section of Zoho Creator, the process of updating records in Zoho Invoice can easily be automated as per requirement. Lets say you have a Zoho Creator form which is used to edit invoice details of an order. To simultaneously edit the same details in our Zoho Invoice's "Invoice" module, you can execute zoho.invoice.update() task in the “On Success” form actions block. This will update the specified records in Zoho Invoice whenever the Zoho Creator form is edited and submitted with new details. Further details on how to execute this task are explained below.

 Supported Modules

  • Invoices
  • CustomerPayments
  • Items
  • Contacts
  • Expenses
  • Estimates
  • ExpenseCategory

 Syntax

response =zoho.invoice.update(moduleName, organisation_id, record_id, {data_map})

where,
<response> - is the map variable returned by Zoho Invoice as response.
<moduleName> - name of module in Zoho Invoice where the record will be updated. (mandatory)
<organisation_id> - required org id in which the record will be updated. Following is an image displaying a sample Organization ID.

<record_id> - id of the record which needs to be updated. (mandatory)
<dataMap> - map variable that holds the key,value pairs. The map key is the label name as specified in Zoho Invoice module and the map value is the field value as submitted in the ZC form. For example, "First Name" : input.First_Name . Here, "First Name" is the the label name as specified in Zoho Invoice module and input.First_Name refers to the value specified in the First_Name field in the Zoho Creator form. (mandatory)

 Example

Following is a sample script that can be added in a Zoho Creator form to edit an existing record in Zoho Invoice. Let's say we have a Creator form containing fields, "Name", "Product", "Quanity" and "Amount" which stores order details of customers. You can add the following script to On Success block of the Creator Form so that whenever this form is edited, details existing in Zoho Invoice's specified module are also edited accordingly. In this case, the module is "Invoice". When the following script is executed, the quantity and amount values as updated in this Form, are updated in the specified record of Zoho Invoice.

response = zoho.invoice.update("Contacts", "10982991", 1687000000116001, {"contact_name" : input.Name});

where,
response - is the map variable returned by Zoho Invoice as response.
Invoice - name of module in Zoho Invoice where the record will be updated.
10982991 - sample Org ID where the records will be updated.
"contact_name" stands for Contact's name in Invoice and it's corresponding value follows afer the colon.
1687000000116001 - sample ID of the record which needs to be updated.

 Response

Response returned by Zoho Invoice as map:

{
"code": 0,
"message": "Contact information has been saved.",
"contact": {
"contact_id": "219715000000070001",
"contact_name": "sunil",
"company_name": "",
"website": "",
"language_code": "",
"language_code_formatted": "",
"contact_salutation": "",
"is_client_review_asked": false,
"has_transaction": false,
"contact_type": "customer",
"owner_id": "",
"owner_name": "",
"source": "api",
"is_crm_customer": false,
"is_linked_with_zohocrm": false,
"primary_contact_id": "",
"zcrm_account_id": "",
"zcrm_contact_id": "",
"payment_terms": 0,
"payment_terms_label": "Due On Receipt",
"currency_id": "219715000000000099",
"currency_code": "INR",
"currency_symbol": "Rs.",
"price_precision": 2,
"outstanding_receivable_amount": 0,
"outstanding_receivable_amount_bcy": 0,
"unused_credits_receivable_amount": 0,
"unused_credits_receivable_amount_bcy": 0,
"status": "active",
"payment_reminder_enabled": true,
"is_client_review_settings_enabled": false,
"average_client_rating": "-0.0",
"custom_fields": [],
"billing_address": {
"address": "",
"city": "",
"state": "",
"zip": "",
"country": "",
"fax": ""
},
"shipping_address": {
"address": "",
"city": "",
"state": "",
"zip": "",
"country": "",
"fax": ""
},
"contact_persons": [],
"pricebook_id": "",
"pricebook_name": "",
"default_templates": {
"invoice_template_id": "",
"invoice_template_name": "",
"estimate_template_id": "",
"estimate_template_name": "",
"creditnote_template_id": "",
"creditnote_template_name": "",
"paymentthankyou_template_id": "",
"paymentthankyou_template_name": "",
"invoice_email_template_id": "",
"invoice_email_template_name": "",
"estimate_email_template_id": "",
"estimate_email_template_name": "",
"creditnote_email_template_id": "",
"creditnote_email_template_name": "",
"paymentthankyou_email_template_id": "",
"paymentthankyou_email_template_name": ""
},
"associated_with_square": false,
"cards": [],
"checks": [],
"bank_accounts": [],
"notes": "",
"created_time": "2016-02-08T13:21:54+0530",
"last_modified_time": "2016-02-08T13:24:10+0530"
}
}

Failure Response:

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

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com