We attempting to use a custom function to pull UTM tracking parameters from a URL field and separate them out into different fields.
1. This is currently working exactly right, however, the URL field in the CRM won't accept that field being populated with any URLs that contain tracking from our Zapier connection. It lets us manually add them, but that is it. It also has a character limit that is too long for some of our tracking data.
2. Zapier suggested switching the URL field to a multi-line text box
3. The function we are using to make it work with the URL field was found in this community and I was able to modify the field names after following the directions, but I don't know how to modify it to the point that it is recognizing a different kind of field with a different name.
Can someone help me modify the following function to reference a multi-line text field called Long Referral to do everything it's already doing in this function?
getLeads = zoho.crm.v1.getRecordById("Leads",leadId);
referrerUrl = getLeads.get("Referrer URL");
info referrerUrl;
urlVal = referrerUrl.indexOf("?");
customVariables = referrerUrl.substring(urlVal + 1);
utm_source = "";
utm_medium = "";
utm_campaign = "";
utm_term = "";
utm_content = "";
gclid = "";
formMap = Map();
for each customVariablesArr in customVariables.toList("&")
{
var_s = getPrefix(customVariablesArr,"=");
val_s = getSuffix(customVariablesArr,"=");
if(var_s == "utm_source")
{
utm_source = val_s;
}
if(var_s == "gclid")
{
gclid = val_s;
}
if(var_s == "utm_medium")
{
utm_medium = val_s;
}
if(var_s == "utm_campaign")
{
utm_campaign = val_s;
}
if(var_s == "keyword")
{
keyword = val_s;
}
if(var_s == "utm_content")
{
utm_content = val_s;
}
}
formMap.put("UTM_source",utm_source);
formMap.put("UTM_medium",utm_medium);
formMap.put("UTM_campaign",utm_campaign);
formMap.put("UTM_term",keyword);
formMap.put("UTM_content",utm_content);
formMap.put("Google Click ID",gclid);
leadupdated = zoho.crm.v1.updateRecord("Leads",leadId.toString(),formMap);
info leadupdated;