All, I'm very new to scripting. Here's my situation. I want to create a function that works like the Convert button, but instead of pushing the data to Contacts and Accounts, it pushes it to Contacts and a custom module that I've built called Recruits.
Here is the script. The first part of it works well, but it will not place the data into a recruits record.
Details = zoho.crm.getRecordById("Leads",leadId.toLong());
//info Details;
tp = Details.get("Type");
if(tp == "Provider")
{
mp = Map();
mp.put("Name",ifnull(Details.get("Name"),""));
mp.put("First_Name",ifnull(Details.get("First_Name"),""));
mp.put("Last_Name",ifnull(Details.get("Last_Name"),""));
mp.put("City",ifnull(Details.get("City"),""));
mp.put("Country",ifnull(Details.get("Country"),""));
mp.put("State",ifnull(Details.get("State"),""));
mp.put("Street",ifnull(Details.get("Street"),""));
mp.put("Zip_Code",ifnull(Details.get("Zip_Code"),""));
mp.put("Description",ifnull(Details.get("Description"),""));
mp.put("Email",ifnull(Details.get("Email"),""));
mp.put("Mobile",ifnull(Details.get("Mobile"),""));
mp.put("Phone",ifnull(Details.get("Phone"),""));
mp.put("CPS_Region",ifnull(Details.get("CPS_Region"),""));
mp.put("Owner",ifnull(Details.get("Owner"),""));
create = zoho.crm.create("Contacts",mp);
//function below does not work
ContactDet = zoho.crm.getRecordById("Leads",leadId.toLong());
mp2 = Map();
mp2.put("Name",ifnull(Details.get("Name"),""));
mp2.put("First_Name",ifnull(Details.get("First_Name"),""));
mp2.put("Last_Name",ifnull(Details.get("Last_Name"),""));
mp2.put("City",ifnull(Details.get("City"),""));
mp2.put("Country",ifnull(Details.get("Country"),""));
mp2.put("State",ifnull(Details.get("State"),""));
mp2.put("Street_Address",ifnull(Details.get("Street"),""));
mp2.put("Zip_Code",ifnull(Details.get("Zip_Code"),""));
mp2.put("Description",ifnull(Details.get("Description"),""));
mp2.put("Email",ifnull(Details.get("Email"),""));
mp2.put("Other_Phone",ifnull(Details.get("Mobile"),""));
mp2.put("Phone_1",ifnull(Details.get("Phone"),""));
mp2.put("CPS_Region",ifnull(Details.get("CPS_Region"),""));
mp2.put("Owner",ifnull(Details.get("Owner"),""));
createrec = zoho.crm.create("Recruits",mp2);
deleteResp = zoho.crm.invokeConnector("crm.delete",{"module":"Leads","id":leadId});
return "success";
}
else
{
return "Lead Must Be a Provider";
}