How to fetch a field value from the row above in a “Sub-form”

The Question:

Is there a way to fetch a field value from the row above in a subform and input into the row below?

The Answer:

You need to think about the ways to identify the previous row. One way is to assign a custom row ID (On Add Row) for each row and get value based on that row ID. Another way is to get value based on multiple field value combo (Product Category and Product, for example). Depending on whichever way works best for you, you can write the script.

Below workflow will allow you to assign a custom row ID and get values based on that.

1) Create the Row ID field in the SubForm (Row_ID as field deluge name)

2) In the parent Form (where the SubForm is placed) go to On Add Row of the SubForm field and add the below script

  1. max_row_id = 0;
  2. //Find the previous max row ID
  3. for each subform_row in input.SubForm
  4. {
  5.       if(subform_row.Row_ID > max_row_id)
  6.       {
  7.             max_row_id = subform_row.Row_ID;
  8.       }
  9. }
  10. //Assign the row id for current row
  11. row.Row_ID = max_row_id + 1;

3) In the on user input of SubForm’s field, you can identify the previous row id and then assign the value to the current row. Below script does exactly that.

  1. prev_row_id = row.Row_ID – 1;
  2. //Find the previous max row ID
  3. for each subform_row in input.SubForm
  4. {
  5.       if(subform_row.Row_ID == prev_row_id)
  6.       {
  7.             row.Field_Name = subform_row.Another_Field //add expressions here
  8.       }
  9. }

If a row above is deleted, you will need to handle delete action as well.

Read More

How to receive Twilio Messages in Zoho Creator.

The Problem:

You would like to post the incoming messages to Twilio into Zoho Creator form. Twilio allow specifying a webhook url to post the message data when an incoming sms is received.

Is this possible? You do not want to use any intermediate php or any code?

The Answer:

Yes, it is possible.

Step 1: Create Form fields to receive Twilio Response

Check Twilio’s webhook response parameters and create field names with exact same names. Refer to

Step 2: Set up Webhook in Twilio to POST to Zoho Creator

Go to Twilio’s phone numbers page and set up Incoming message action to post to Zoho Creator. Refer to Zoho Creator REST API ->

Step 3: Setup Done. Send a Message

And you will see the message in your Zoho Creator Report.

Read More

How to keep XML RPC API Auth Token private in a public form?

The Problem:

You have a public form that we wish to add records into a creator application including is’t subform).

You are able to successfully submit our form data into Creator using the XML RPC API, with the data structure as per the support doc examples –

Now the question is how do you keep the Auth Token private? Anyone who inspects the source code of the form will be able to view the auth token and username.


The Answer:

You can create a server file (php or nodejs or any other server page of your choice), to act as a middleware and handle the data post to Zoho Creator. This allows you to store private information on your server so it’s not visible to client. Here’s what I would do in a php file.

file_name: add_record.php


define(“authtoken”, “yourAuthToken”);
define(“zc_ownername”, “yourZohoUserName”);
$xml_string = $_REQUEST[“XMLString”];

//Add to Zoho

function insert_record($xml_string){
$api_url = “”;
$post_params = array();
$post_params[‘authtoken’] = constant(“authtoken”);
$post_params[‘scope’] = ‘creatorapi’;
$post_params [‘XMLString’] = $xml_string;
$post_params[‘zc_ownername’] = constant(“zc_ownername”);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$result = curl_exec($ch);

You can post your form to add_record.php instead of url

Read More

How to disable logged in WordPress user notification on Zoho SalesIQ?

We use WordPress for our website. We also use Zoho SalesIQ to track visitors and chat with them. But, It gets annoying when our employees with WordPress login visits the web page and we get notified on SalesIQ. We decided to stop that from happening. This is what we did. I’m sure there are other approaches, but this is what we do.

Step 1: Find out the SalesIQ plugin

If you look at your hosting file manager or the plugin page on WordPress admin site, you can find out the SalesIQ plugin folder. Get into that and find the index.php file.

Step 2: Edit the index.php file

Warning: This is not a preferred method to edit a plugin. You should always copy the plugin, edit files and upload them as a new one. Editing an existing plugin also affects the changes when the plugin is updated by the developer(Zoho). Keeping that in mind, please proceed to the further steps with caution.

Find the line that starts with “function ld_embedchat()“. It is a php function and that is where Zoho SalesIQ decides whether or not to show the chat

Step 3: Edit the ld_embedchat() function

In the first if, where they return an empty value, add your custom script.

Step 3.1: To Hide SalesIQ for Logged In Users

Add “|| is_user_logged_in()” as criteria. It should look like

if ( !preg_match( "/^<script[^>]*>.+float\.ls.+<\/script>$/s", $ldcode_str ) || is_user_logged_in() )

Instead of

if ( !preg_match( "/^<script[^>]*>.+float\.ls.+<\/script>$/s", $ldcode_str ) )

Step 3.2: To Hide SalesIQ based on custom IP address

Get the IP address of the visitor using the below script

$ip_to_hide = "yourIPAddress";//add the IP address for which you want to hide SalesIQ

if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
} else {

Add it to your if criteria as,

if ( !preg_match( "/^<script[^>]*>.+float\.ls.+<\/script>$/s", $ldcode_str ) || is_user_logged_in() || $ip == $ip_to_hide )

Step 4: Update plugin

Once you have completed the above step. Click Update File – If you’re editing from WP admin page- or upload the edited file to your server.

If you reload your website – clear cache probably- you will no longer be notified for your wordpress users on Zoho SalesIQ.

If you have any questions or suggestions, please contact us from our Contact page.

Read More

Get Japanese Address from post code using Zoho Creator Deluge

The requirement

Input 7 digit Japanese postal code (###-####) and get the address.

Language used

Zoho Creator Deluge

Data Source ->

Deluge Code

Below is the function that takes 7 digits postal code as two inputs (first 3 digits and second 4 digits) and returns an address.

map postal.get_address(string first_three, string second_four)
    this_address = map();
    first_three_len = ifnull(input.first_three,"").length();
    second_four_len = ifnull(input.second_four,"").length();
    if ((first_three_len  ==  3)  &&  (second_four_len  ==  4))
        postal_code = input.first_three + input.second_four;
        data_url = "" + input.first_three + ".js";
        str = getUrl(data_url);
        value_map = str.toMap();
        my_map = (value_map.get(postal_code)).toMap();
        jp_address = ((my_map.get("perfecture_jp")) + my_map.get("jp_add_1")) + my_map.get("jp_add_2");
        eng_address = ((my_map.get("prefecture")) +" " +  my_map.get("city")) + " " +  my_map.get("town");
        this_address.put("jp_address", jp_address);
        this_address.put("eng_address", eng_address);
    return this_address;


Screen Shot 2017-02-07 at 8.38.49 AMScreen Shot 2017-02-11 at 6.07.50 PM

Read More

Zoho Creator URL parameters fix

The Problem

If you are opening a Zoho Creator Form from a third party, and it includes the query string as “?first-name=Rob”, there is no direct way to get the value of “first-name” into a field in your Form. It will not work because Deluge names can’t have “-” in them.

Question posted at :

The Solution

There are only two places in Zoho Creator that can read URL parameters. 1. Form and 2. Pages. Both don’t accept “-” in parameter/field names. So, the optimal solution will be,

  1. Write a php file to convert “-” formatted query strings into “_” formatted query strings and open Zoho Creator Form with new query strings
  2. Host it on your server
  3. Link your hosted php file to your third party

The Php code

I have given the php code below. You can change the Location url to your Zoho Creator Form Url

$query_string = $_SERVER['QUERY_STRING'];
parse_str($query_string, $query_array);
foreach ($query_array as $key => $value) {
$newkey = str_replace("-", "_", $key);
$query_array[$newkey] = $value;
header("Location:" . http_build_query($query_array) );


Click and you will be redirected to our Zoho Creator Form with the formatted query strings.


Read More

Xero and Zoho Integration – A guide for developers – part 1

This guide will walk you through the steps for integrating Xero accounting Software with Zoho Creator applications. I have decided to split this guide into multiple parts. You can expect the next part soon.


  1. A hosting account -> php based.
  2. Basic knowledge of understanding php code and XML
  3. Basic knowledge of posturl task in Zoho Creator

The Challenge

Xero requires OAuth for authentication. So, a simple URL request with a client ID or secret code does not allow you to integrate Zoho Creator with Xero application. It also requires certificate files and validate through xero php classes.

The Solution

We looked at the php library for Xero, written by Xero team and wanted to make use of it. Also, everyone at our company understands php and Zoho Creator. So, we thought we will pick this one. They also have libraries for other languages, if you don’t want to use php. But, this article assumes you are using the php library.

The Steps

1. Download the copy of Xero PHP API library

Download the Php API library for Xero from and unzip it.

2. Working with the downloaded library

  • After downloading the file, you can unzip it to the Xero folder
  • If you have a hosting account and if you can edit the files online, upload the xero folder to your hosting server
  • If you want to test it in your localhost, you can move the xero folder to your localhost path
  • Once it is done, you can verify if it is uploaded correctly by accessing your xero path from your server (localhost/hosted)

3. Understanding the downloaded Library

The Php library you just downloaded has 3 folders(directories) and a few files.  We will go through the folders and private.php file in this guide.

certs folder

This folder holds the private certificates you will generate for the purpose of using this api. According to Xero,

Private and Partner applications must sign messages using the OAuth RSA-SHA1 method.

This requires that you create a public/private key-pair, and upload the public certificate during application registration. We refer to this certificate as an application certificate.

To get started with creating a public/private key-pair we recommend the use of OpenSSL

For the steps to create self-signed certificates, visit

After you are done with creating certificates (privatekey.pem and publickey.cer files), upload them to the certs folder. These files are important as Xero will check for the certificates while making the api connection

lib folder

This folder contains php classes that connect with Xero server at different times and authenticate the user

test folder

The tests.php file in this folder has sample requests for all the Xero APIs. You can use the code from this file, instead of writing your own code while pushing data to Xero.

private.php file

As soon as you create a new Private application from Xero (it’s free and easy, steps at, you will find the consumer_key and shared_secret on the application page. Copy them and paste them in the private.php file. Like below

$signatures = array (
'consumer_key' => "Your Consumer Key",
'shared_secret' => "Your Shared Secret",
// API versions
'core_version' => '2.0',
'payroll_version' => '1.0',
'file_version' => '1.0'

4. Testing the Xero Connection

To be continued in part 2…

Read More

US address verifier using usps API

We came across a requirement where one of our customers wanted to verify the address entered. It took a while to get the right API method that would work. Fortunately, USPS offers a good API and documentation on this. We are listing the steps below to achieve the same in your application.


  1. A USPS api USER ID, created at
    You will receive an email after the registration with the userid (created automatically by usps)
  2. Knowledge of Zoho Creator’s PostURL and XML parsing and deluge scripting

How it is done : 

We have created the following fields on the Form

  1. Address fields – Street Address, Apt no, City, State, Zip-
  2. a decision box “Verify Address”, to initiate the address verifier
  3. an Add notes field “address_display”, to display the verified address
  4. a decision box “Update Address”, to update the address fields with the correct address

Script Execution:

On user input of “Verify Address” field triggers the address verifier and updates the address_display notes field and has the following script

if (input.Verify_Address)
    xml_string = thisapp.usps.construct_xml(input.Street_Address, input.Apartment_or_Suite_Number, input.City, input.State, input.Zip_Code);
    usps_resp = thisapp.usps.verify_address(xml_string);
    resp_map = thisapp.usps.beautify_xml(usps_resp);
    input.Verified_Address = resp_map.toString();
    input.address_display = resp_map.get("address_display_html");

1. Construct the XML

string usps.construct_xml(string street_address, string apt_no, string city, string state, string zip)
 xml_string = "<AddressValidateRequest USERID=\"your_user_id_from_usps_email\"><IncludeOptionalElements>true</IncludeOptionalElements> <ReturnCarrierRoute>true</ReturnCarrierRoute><Address ID=\"0\"><FirmName />";
 xml_string = xml_string + "<Address1>" + ifnull(input.apt_no,"") + "</Address1>";
 xml_string = xml_string + "<Address2>" + ifnull(input.street_address,"") + "</Address2>";
 xml_string = xml_string + "<City>" + ifnull(,"") + "</City>";
 xml_string = xml_string + "<State>" + ifnull(input.state,"") + "</State>";
 xml_string = xml_string + "<Zip5>" + ifnull(,"") + "</Zip5>";
 xml_string = xml_string + "<Zip4></Zip4>";
 xml_string = xml_string + "</Address></AddressValidateRequest>";
 return xml_string;

2. Use the Zoho Creator’s post url to verify address from USPS website

string usps.verify_address(string xml_string)
 usps_url = "";
 params = map();
 params.put("API", "Verify");
 params.put("XML", input.xml_string);
 usps_resp = postUrl(usps_url, params);
 return usps_resp;

3. Parse the XML and store the response in a map/object variable

map usps.beautify_xml(string xml_string)
 xml_map = map();
 address_display_html = ("<style>.list-group-item{list-style: none;color:#fff;}</style><div id='address_display_custom' style='background-color:#5cb85c;border-color:#5cb85c;width:300px;padding:4px;border-radius:4px;border:1px solid rgba(0,0,0,.125);'><ul class='list-group'>");
 street_address_val = input.xml_string.executeXPath("/AddressValidateResponse/Address/Address2/text()");
 xml_map.put("street_address_val", street_address_val);
 address_display_html = address_display_html + "<li class='list-group-item'>" + street_address_val + "</li>";
 apt_no = input.xml_string.executeXPath("/AddressValidateResponse/Address/Address1/text()");
 xml_map.put("apt_no", apt_no);
 address_display_html = address_display_html + "<li class='list-group-item'>" + apt_no + "</li>";
 city_val = input.xml_string.executeXPath("/AddressValidateResponse/Address/City/text()");
 xml_map.put("city_val", city_val);
 address_display_html = address_display_html + "<li class='list-group-item'>" + city_val + "</li>";
 state_val = input.xml_string.executeXPath("/AddressValidateResponse/Address/State/text()");
 xml_map.put("state_val", state_val);
 address_display_html = address_display_html + "<li class='list-group-item'>" + state_val + "</li>";
 zip_val = input.xml_string.executeXPath("/AddressValidateResponse/Address/Zip5/text()");
 xml_map.put("zip_val", zip_val);
 address_display_html = address_display_html + "<li class='list-group-item'>" + zip_val + "</li>";
 address_display_html = address_display_html + "</ul> </div> ";
 xml_map.put("address_display_html", address_display_html);
 return xml_map;

To update fields with correct address, the Update Address field’s on user input has the following script

Note: Verified_Address is a hidden multi-line text field to store the map response.

if (input.Update_Address  &&  (input.Verified_Address  !=  ""))
    xml_map = input.Verified_Address.toMap();
    input.Apartment_or_Suite_Number = xml_map.get("apt_no");
    input.Street_Address = xml_map.get("street_address_val");
    input.City = xml_map.get("city_val");
    input.State = xml_map.get("state_val");
    input.Zip_Code = xml_map.get("zip_val");

Live Preview

Read More

Display Currency value with commas and two decimals in Zoho Creator

string nullFix.currencyToStr(float num)
    //num = 1234567.98;
    myStr = "0.00";
    if (input.num  !=  null)
        input.num = input.num.round(2);
        myStr = input.num.toString().replaceAll(("(?<!\.\d)(?<=\d)(?=(?:\d\d\d)+\b)"),",");
    return myStr;

Live Preview… Try different currency values below and hit tab key

Read More