Adding data from one module to a custom module

Adding data from one module to a custom module

Hello! so i'm trying to make a function to transfer information from one module to another. Essentially when a contact is "closed" i have it move to a new module to reduce clutter, but some information needs to be saved. I already maxed out the line limit on the "Create Record" workflow. 

This is the function i have so far, which works for contacts to enrollments, but it isn't working for this one. When i check for errors, it say that it can't find a related record, even though i have a lookup attaching them. Am i missing something?

contactMap = zoho.crm.getRecordById("Contacts",contactId);
relatedStudents = zoho.crm.getRelatedRecords("Declined Students","Contacts",contactId);
for each  student in relatedStudents
{
spa = contactMap.get("SPA");
street = contactMap.get("Mailing_Street");
street2 = contactMap.get("Mailing_Street_Line_2");
city = contactMap.get("Mailing_City");
county = contactMap.get("County");
state = contactMap.get("Mailing_State");
zip = contactMap.get("Mailing_Zip");
gender = contactMap.get("What_gender_do_you_identify_as");
pronoun = contactMap.get("What_are_your_pronouns");
education = contactMap.get("Highest_level_of_education");
language = contactMap.get("What_is_your_primary_language");
sexOrientation = contactMap.get("What_best_describes_your_sexual_orientation");
maritalStatus = contactMap.get("What_is_your_marital_status");
agency = contactMap.get("Registration_Agency1");
paid = contactMap.get("Paid_Unpaid");
updateMap = Map();
updateMap.put("SPA",spa);
updateMap.put("Mailing_Street",street);
updateMap.put("Mailing_Street_Line_2",street2);
updateMap.put("Mailing_City",city);
updateMap.put("Mailing_State",state);
updateMap.put("Mailing_Zip",zip);
updateMap.put("County",county);
updateMap.put("Gender",gender);
updateMap.put("Pronouns",pronoun);
updateMap.put("Education",education);
updateMap.put("Primary_Language",language);
updateMap.put("Sexual_Orientation",sexOrientation);
updateMap.put("Marital_Status",maritalStatus);
updateMap.put("Registration_Agency",agency);
updateMap.put("Paid_Unpaid",paid);
zoho.crm.updateRecord("Declined Students",student.get("id"),updateMap);
}

Thanks for any help you can give!


      Zoho Developer Community









                                Zoho Desk Resources

                                • Desk Community Learning Series


                                • Digest


                                • Functions


                                • Meetups


                                • Kbase


                                • Resources


                                • Glossary


                                • Desk Marketplace


                                • MVP Corner


                                • Word of the Day



                                    Zoho Marketing Automation


                                            Manage your brands on social media



                                                  Zoho TeamInbox Resources

                                                    Zoho DataPrep Resources



                                                      Zoho CRM Plus Resources

                                                        Zoho Books Resources


                                                          Zoho Subscriptions Resources

                                                            Zoho Projects Resources


                                                              Zoho Sprints Resources


                                                                Qntrl 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





                                                                            Design. Discuss. Deliver.

                                                                            Create visually engaging stories with Zoho Show.

                                                                            Get Started Now