Hi, Wonder if anyone can help... so we have enquiries coming into a custom module and sometimes customers have submitted more than one, I would like to ensure that if a new field within the contacts module "First Enquiry date" is empty that it populates this with the first created time out of all enquries made, e.g X made an enquiry 22/11/2023 but has previously made 5 others with the first record being created 20/04/2023 (I would like this date adding as the first enquiry date in the contact.
Here is the code below, but it doesnt seem to be playing ball?
gcus = zoho.crm.getRecordById("Enquiry_Detail",eid);
//info gcus;
gcid = gcus.getJson("Contact_ID").getJson("id");
info gcid;
gc = zoho.crm.getRecordById("Contacts",gcid);
//info gc;
gd = gc.getJson("First_Enquiry_Date");
if(gd == null)
{
grel = zoho.crm.getRelatedRecords("Enquiry Detail","Contacts",gcid);
// info grel;
for each ele in grel
{
gcrt = ele.getJson("Created_Time");
// info gcrt;
}
info gcrt;
// nd = gcrt.getPrefix("T").toString();
// mp = map();
// mp.put("First_Enquiry_Date", nd);
// info mp;
// up = zoho.crm.updateRecord("Contacts", gcid, mp);
// info up;
}