Hi, I am currently trying to write a Deluge Function that automatically links a record from the Contacts Module to a record on our custom Faculty module. To be clear, these two things are not linked at first, but we hope that this deluge function does the work of linking two things for us.
Here is my code. All API names are correct- we double checked. Faculty4 for example happens to represent the API for the related list label "Faculty" within the Contacts module.
contactDetails = zoho.crm.getRecordById("Contacts",contactId);
programName = ifnull(contactDetails.get("Program"),"");
searchPrograms = zoho.crm.searchRecords("Faculty","(Grouping:equals:ABCD)");
if(searchPrograms.size() > 0)
{
facultyId = searchPrograms.get(0).get("id");
mp = Map();
mp.put("Faculty4",facultyId.toLong());
linkContactToProgram = zoho.crm.updateRelatedRecord("Contacts",contactId.toLong(),"Faculty",facultyId.toLong(),mp);
info linkContactToProgram;
}
Now, the code runs and works, though it doesn't actually do the linking. I've tested each individual line using the "info" function and seeing if each line outputs what it should, and it seems like the line that is not performing as it should is the line of linkContactToProgram.
Please let me know what I can do to fix this up! Thanks!