This article will help you configure Zoho CRM workflows that will automatically register your customers and their personalized map links that were configured using this guide in the Zoho Creator portal created by following this guide.
Summary of implementation steps
We'll be creating two Zoho CRM Workflow Rules:
For every new Customer CRM record with non-empty map link we'll be creating a new Customer form record in the Creator portal, and save the ID of the created record in a new custom field Creator_id in the Customer CRM record.
When a Customer's map link changes in the CRM, we'll create or update the corresponding Customer form record in the Portal.
Note about terminology: an object, like a Customer, that is normally stored as a table in a database, is referenced by the term module in Zoho CRM, and by the term form in Zoho Creator. So the Customer object, table, module and form - are all essentially the same thing.
Step-by-step implementation guide
1- Create a connection to your Zoho Creator (if you don't have it yet)
If you don't yet have a connection with your Zoho Creator, let's create it:
Go to Setup -> Connections:
On the Create connection screen, scroll down and select Zoho Creator:
Enter the connection name and link name
creator
, scroll down and selectZohoCreator.form.CREATE
scope, and press Save and Connect:On the screen that will open, make sure the Status is CONNECTED:
2- Create a custom field Creator_id in the Customer module
This field will be used to link the Customer form record in Zoho Creator to the Customer module record in Zoho CRM.
In Zoho CRM:
Go to Setup -> Modules and Fields:
Open the Customers module -> Standard layout:
Add a Single Line type field Customer_id:
Press Save.
3- Create a Workflow Rule for new Customer records
Go to Setup -> Workflow Rules:
Press Create Rule:
Select the Customers module and configure the Rule as shown on the screenshots below:
If you already have functions, you'll see this screen (if it's your first function, this screen will be skipped and you can proceed to the next one):
Select Write your own:
Fill in the function's properties:
Click Edit Arguments:
Add and fill in arguments as shown below:
Click Save.Add the code below to your function. The code creates a new "Customer" form record in Creator for this CRM record if it hasn't been created yet, and stores its ID into the CRM's Creator_id field; or updates the "Customer" form record in Creator if it was already created before:
dmap = Map();
dmap.put("Email",Email);
dmap.put("Map_link",Map_link);
omap = Map();
if(Creator_id.isBlank())
{
dmap.put("CRM_ID",Id);
r = zoho.creator.createRecord("sampleco","customer-portal","Customer",dmap,omap,"creator");
rmap = Map();
rmap.put("Creator_id",r.getJson("data").getJson("ID"));
r2 = zoho.crm.updateRecord("Customers",Id,rmap);
}
else
{
r = zoho.creator.updateRecord("sampleco","customer-portal","Customer",Creator_id,dmap,omap,"creator");
}
IMPORTANT NOTE #1. Replacesampleco
increateRecord
with the actual app owner of your Portal. Also, if you're using a Portal app name other than Customer portal, replacecustomer-portal
with the name of your app. You can find both in the Portal's URL. In this example,sampleco
is the app owner andcustomer-portal
is the app name:
sampleco
is the app owner.
IMPORTANT NOTE #2. If you already had a connection to your Zoho Creator under a different name, replacecreator
increateRecord
with the name of your existing connection and double-check that it has theform.CREATE
scope.
Press Save to save the function:
And then Save again to save the Rule:
4- IMPORTANT! Change the function's 'Id' argument from 'int' to 'string'
At the time of writing this article, Zoho CRM seems to have a small bug: when you added the Id argument and mapped Customer - Customer id as its value, Zoho assigned type int to the argument, but record IDs are longer that int. So we need to manually change the type of the Id argument from int to string. And this can be done only when we open the function specifically from Setup -> Functions. So, to do this:
Go to Setup -> Functions:
Click the newly created function in the list, then click Edit function:
Click Edit arguments:
Here, unlike when Edit arguments is clicked when the function was edited from within the Workflow Rule, we can edit types of arguments. Select string for Id:
Click Save.
Then Save again:
5- Create a Workflow Rule for existing Customer records
Return to the Workflow Rules screen and press Create Rule again, and make sure the Rule is configured as shown on these screenshots:
Associate the same function that we created earlier:
Press Save to save the Rule: