Script to populate lookup field to custom module record back the lead it was based off
Hello,
I have the below code which currently creates a new record in a custom module when a new lead is created. This works great, however I cannot get the record to link back to the lead.
void Create_building_from_name(String Address1,Int inhabitant_id,String lead_name,String Address2,String Address3,String Postcode,String City)
// Inhabitant_ID is the lead ID and and lead_name is Last Name
- inhabitant_record = zoho.crm.getRecordById("Leads",inhabitant_id);
- info inhabitant_record;
- inhabitantFirstName = inhabitant_record.get("First_Name");
- inhabitantLastName = inhabitant_record.get("Last_Name");
- building_map = Map();
- building_map.put("Name",Address1);
- building_map.put("Address_1",Address1);
- building_map.put("Address_2",Address2);
- building_map.put("Address_3",Address3);
- building_map.put("Postcode",Postcode);
- building_map.put("Current_Tenant_Name",inhabitantFirstName + " " + inhabitantLastName);
- building_map.put("City",City);
- create_building = zoho.crm.create("Buildings",building_map);
- info create_building;
- info building_map;
Can anyone please help me determine how to have a working lookup?
Also is there a way to maintain this connection when the lead is converted to an account?
Thanks