Deluge Help

Creating a Record in Zoho Books

Table of Contents

 Overview

Using zoho.books.createRecord() Deluge task in Zoho Creator, you can create records in Zoho Books. You can make use of different workflow options in Zoho Creator to automate this process . Create contacts, generate invoices and update payments in Zoho Books, as and when you need to, using this task.

 Supported Modules

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

 Syntax

<response> = zoho.books.createRecord(<module>, <orgID>, <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 will be added. 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.
<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.

 Examples

1) Create a record in Zoho books using Zoho Creator form

In this example, a record is created in Zoho Books' Contacts module byadding code to a Zoho Creator form. The form consists of fields "Contacts" and "email". Upon submission of the form, a record gets created in Zoho Books using the data submitted.

response = zoho.books.createRecord("contacts", "12345678", { "contact_name" : input.contact, "email" : input.email});
  • Submitting the form will create a new record in your Zoho Books with contact name "John and email "john@zillum.com"

where,
Contacts is the name of your Zoho Books Module where the record will be added.
12345678 is a sample organization ID. Replace it with your organization ID.
"contact_name" and "email" are the label names as specified in the Zoho Books module. input.contact and input.email refer to the value specified in the contact and email fields in the Zoho Creator form respectively.

2) Create a record in Zoho Books using Scheduler in Zoho Creator.

In this example, a record is automatically created in Zoho Books' Contacts module at the specified date and time using Zoho Creator Scheduler. The added code contains the data that is used to create the record in Zoho Books.

  • Create a custom schedule using Scheduler and mention the date, time and frequency in "When to do".
  • Add the following script in "What to do" and click on "Save".
response = zoho.books.createRecord("contacts", "12345678", { "contact_name" : "john", "email" : "john@zillum.com"});

This will add a record in Zoho Books automatically at the specified date and time with contact name "John and email "john@zillum.com"

where,
response is the map variable returned as response. It contains the details of the newly created record.
Contacts is the name of the Zoho Books Module where the record will be added.
12345678 is a sample organization ID. Replace it with your organization ID.
"contact_name" and "email" are the label names as specified in the Zoho Books module. "john" and "john@zillum.com" refer to the values of the two label names respectively.

 Response Format

The following code for createRecord() task,

params = map();
params.put("contact_name", "Zoho Creator");
response = zoho.books.createRecord("Contacts", "35201411", params);
info response;

yields the following response format,

{
"message":"The contact has been added.",
"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 - param name passed as contactname instead of contact_name

{"message":"Invalid value passed for contact_name","code":4}

Share this post : FacebookTwitter

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

Write to us: support@zohocreator.com