This is the code I've used for the lead module. It creates calls, but fails to associate them with the lead. Seems this should be a simple, common sense feature, that shouldn't need to be coded. But here it is...my code to automate something that happens multiple times a day, everyday....and that code won't even work right. Some CRM!
I need to know what's missing, why the lead names are not being associated. Please please, don't rewrite the whole entire code for me, thanks. This program requires a lot of coding and I'm trying to learn how to write the codes my business needs so I can update this stuff as needed and not be dependent on...and waiting days for... someone else to do it. Just give me only the piece of code that's missing or correct only the piece of code that does what I require. and I'll do it. And if nothing is missing (which i don't think anything is missing) why is it not working?
leadIdLong=input.leadId.toLong();
leadDetails = zoho.crm.getRecordById("Leads",leadIdLong);
first=ifnull(leadDetails.get("First Name"),"");
last=ifnull(leadDetails.get("Last Name"),"");
name=first + " " + last;
mobile=ifnull(leadDetails.get("Mobile"),"");
landphone=ifnull(leadDetails.get("Phone"),"");
if(mobile == "")
{
phone=landphone + " " + "landline";
}
else if(landphone == "")
{
phone="no ph#";
}
contactType=ifnull(leadDetails.get("Contact Type"),"");
if(contactType == "Lead 1")
{
date=(today.toDate().addDay(3)).toString("yyyy-MM-dd 08:00:00");
}
else if(contactType == "Lead 2")
{
date=(today.toDate().addDay(5)).toString("yyyy-MM-dd 08:00:00");
}
else if(contactType == "Lead 3")
{
date=(today.toDate().addDay(7)).toString("yyyy-MM-dd 08:00:00");
}
callMap=map();
callMap.put("Contact Name ",input.leadId);
callMap.put("Related Record",input.leadId);
callMap.put("Subject",name + " " + "lead call" + " " + phone);
callMap.put("Call Type","Outbound");
callMap.put("Call Purpose","Prospecting");
callMap.put("whichCall","ScheduleCall");
callMap.put("Status","Not Started");
callMap.put("Call Start Time",date);
callMap.put("SEID ",input.leadId);
callMap.put("SEMODULE ","Leads");
callMap.put("SMOWNERID",ifnull(leadDetails.get("SMOWNERID"),""));
createCall = zoho.crm.create("Calls",callMap);