InteGreat 03: Integrating Zoho Creator with Zoho Books

InteGreat 03: Integrating Zoho Creator with Zoho Books



Hi everyone,

Today, we'll look at how to integrate your Zoho Creator app with Zoho Books. This is one of the most popular Zoho integrations that our customers use. 

You can use this integration to automate processes like:

  • Creating quotes and invoices in Zoho Books from within Zoho Creator
  • Accessing quotes, bills, and invoices from within Zoho Creator
  • Linking bills and invoices to a project and performing profit calculations

With Deluge, you can use the built-in integration task to connect with the different modules in Zoho Books. Here are the different Zoho Book modules that we support:

  • Contacts
  • Invoices
  • Customer Payments
  • Items
  • Estimates
  • Recurring Invoices
  • Expenses

Add data to Zoho Books


You can add a record when submitting a Zoho Creator form and have it simultaneously added in Zoho Books, without re-entering the data a second time in Books. You can do this with the zoho.books.createRecord() Deluge task.

Syntax:
  1. <response> = zoho.books.createRecord(<module>, <orgID>, <params>);
Use case:

Let's say you're collecting details about your resellers using a Creator form, and you need to pass this information on to Books to send them an estimate or a sales order. That is, whenever a new reseller is added to Creator, we'd need to create a new contact in Books.

The "Add New Reseller" form has the following fields:

  • Name (single line field type)
  • Company Name (single line field type)
To create this record simultaneously in the Contacts module of Zoho Books, you need to execute the zoho.books.create() task in the On Success actions block of the "Add New Reseller" form. Thus, whenever you fill in the "Add New Reseller" form and submit it, it automatically creates a record in Zoho Books with the relevant details.

You can achieve this using the following script:

  1. resellerInfo = Map();
  2. resellerInfo.put("contact_name",input.Name);
  3. resellerInfo.put("company_name",input.Company_Name);
  4. response = zoho.books.createRecord("Contacts","<ORG ID OF ZOHO
  5. BOOKS>,resellerInfo);
For more details click here.

Fetch data from Zoho Books:

Similarly, you can fetch data from Zoho Books and have it populate a Zoho Creator form. You can achieve this by using the zoho.books.getRecords() task in Zoho Creator.

Syntax:
  1. <response> = zoho.books.getRecords (<module>, <orgID>,<search>);
Use case:

This task works if you want to fetch the list of all your product items stored in Zoho Books and populate them in a drop-down field in Zoho Creator.

The "Customer Details" form has the following fields:

  • Customer Name (single line field type)
  • Items (dropdown field type)
You can fetch the name of each item from the Items module and populate the items field using the ui.add() task. All you need to do is write the below script in the On Load action block of the Zoho Creator form.

  1. response = zoho.books.getRecords("Items",<ORG ID OF ZOHO BOOKS> );
  2. itemList= response.get("items").toJSONList();
  3. for each item in itemList
  4. {
  5. input.Items:ui.add(item.getJSON("item_name"));
  6. }
For more details on this task please click here.

Update Data in Zoho Books

Next, let's look at how to update records in Zoho Books by simply submitting a form with the relevant details in Creator. You can achieve this by using the zoho.books.updateRecord() task in Creator.

Syntax:

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

Let's say you're updating the reseller information that you entered earlier using the Zoho Creator form. Now, you need to update this information in Zoho Books as well.

The "Add New Reseller" form has the following fields:

  • Name (single line field type)
  • Company Name (single line field type)
We can trigger this task with the "On Validate" action of the form.

You can achieve this using the following script:

  1. if(old.Name != input.Name // check if the Name is changed when you edited the record
  2. {
  3. search=encodeUrl(old.Name);
  4. sp1 = zoho.books.getRecords("Contacts",<ORG ID FROM
  5. BOOKS>,"contact_name=" + search);
  6. contact_id = sp1.get("contacts").get(0).getJSON("contact_id");
  7. Update_Map = Map();
  8. Update_Map.put("contact_name",input.Name);
  9. resp = zoho.books.updateRecord("Contacts",<ORG ID FROM
  10. BOOKS>,contact_id,Update_Map);
  11. }
For more details, please check here.

 

We hope this post on Zoho Books integration was useful to you. If you have any questions, feel free to add them as comments below. We'll be happy to address them all for you!