Creating a Related Record via Deluge

Creating a Related Record via Deluge

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.

It does this by getting the contact id (this is the argument of the function) and finding which Program that contact is assigned to (Program is a field) and finding a match for which Faculty has a Grouping (a column in their module) equal to the Contact's Program. It then should link that faculty to the contact by using both of their ID numbers (the long string of numbers that appear at the end of a URL when clicking their records)

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!

    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方