[Zoho CRM] How to split a single field with coordinates into separate Latitude and Longitude using Deluge

Learn how to use Zoho Deluge to fill in two separate fields Latitude and Longitude from a single field with both coordinates

Sergey Shurygin avatar
Written by Sergey Shurygin
Updated over a week ago

If you have a single field with both latitude and longitude and need to copy each of the coordinates into a separate field, you may do it by creating two workflow rules that will execute simple Deluge custom function.

Let's assume you have a Location field in the Leads module that has values like
-8.57328,115.28364 and you'd like to copy -8.57328 into Latitude and 115.28364 into Longitude when a new Lead is created or the Location field of an existing Lead changes. To do this, create two workflow rules in the Leads module:

1- One that will be triggered when a Lead is Created:

2- One that will be triggered when Location field changes:

As the Action in both rules select Function and create a new custom function with two arguments:

In the function body place the following code:

latitude = location.left(location.indexOf(","));
longitude = location.right(location.length() - location.indexOf(",") - 1);
zoho.crm.updateRecord(
"Leads",
leadId.toString(),
{"Latitude":latitude,"Longitude":longitude}
);

Did this answer your question?