Hi, I am trying to code when the "Active Lead Status" field is changed to "Dead"
, a copy of the record should be created in the "Dead Leads" module while keeping the original lead in "Active Leads." I am using the following code but I keep getting the error code " Improper code format Correct format : <return_type> <category>.<function_name>(<type> <arg1>, <type> <arg1>,...<type> <arg50>){ <code> }" . Any help would be appreciated.
Code Pasted:
// Function to copy an Active Lead to Dead Leads when "Active Lead Status" is set to "Dead"
void automation.CopyToDeadLeads(int leadId)
{
// Fetch the Active Lead record using the provided ID
leadDetails = zoho.crm.getRecordById("Active_Leads", leadId);
// Ensure the record exists before proceeding
if(leadDetails.containsKey("id"))
{
// Prepare data for Dead Leads module
Map deadLeadData = Map();
deadLeadData.put("Dead_Lead_Name", leadDetails.get("Last_Name"));
deadLeadData.put("Units", leadDetails.get("Units"));
deadLeadData.put("Land_Size", leadDetails.get("Land_Size"));
deadLeadData.put("Asking_Price", leadDetails.get("Asking_Price"));
deadLeadData.put("Project_Type", leadDetails.get("Project_Type"));
deadLeadData.put("Broker", leadDetails.get("Broker"));
deadLeadData.put("Company", leadDetails.get("Company"));
deadLeadData.put("Development_Lead", leadDetails.get("Development_Lead"));
deadLeadData.put("Dead_Lead_Status", leadDetails.get("Active_Lead_Status")); // Ensuring correct field mapping
deadLeadData.put("Description", leadDetails.get("Description"));
deadLeadData.put("Street", leadDetails.get("Street"));
deadLeadData.put("City", leadDetails.get("City"));
deadLeadData.put("State", leadDetails.get("State"));
deadLeadData.put("Zip_Code", leadDetails.get("Zip_Code"));
// Insert into Dead Leads module
Map createResponse = zoho.crm.createRecord("Dead_Leads", deadLeadData);
// Log response for debugging
info createResponse;
}
}