I am trying to write a function that looks to see if a lead has had any campaigns assigned to it and if so, change the status to "Attempted to Contact". The code I am using is below:
relatedCampaign = zoho.crm.getRelatedRecords("Campaigns","Leads",LeadID);
info relatedCampaign;
if(relatedCampaign != null)
{
info "found something";
LeadUpdateMap = Map();
LeadUpdateMap.put("Lead_Status","Attempted to Contact");
updateResp = zoho.crm.updateRecord("Leads",LeadID,LeadUpdateMap);
}
else
{
info "nothing here";
LeadUpdateMap = Map();
LeadUpdateMap.put("Lead_Status","Not Contacted");
updateResp = zoho.crm.updateRecord("Leads",LeadID,LeadUpdateMap);
}
Unfortunately, in testing the leads always end up in the "found something" category instead of detecting that there are no campaigns (even if there are none.
Any help is appreciated!