Nesting one searchRecords function inside another

Nesting one searchRecords function inside another

Hi all,

I am trying to nest one searchRecords function inside another, but when I attempt to save the Deluge I get the following error:

Error at line number:
Improper Statement
Error might be due to missing ';' at end of the line or incomplete expression

My code is:

  1. resellerDetails = Resellers[User == zoho.loginuser];
    resellerName = resellerDetails.Reseller_Name;
    resellerCRMID = resellerDetails.Reseller_CRM_ID;
    //Support Partner
    accountSupportPartner = zoho.crm.searchRecords("Accounts","(Support_Partner:equals:" + resellerCRMID + ")");
    for each arec in accountSupportPartner {
    accountID = arec.get("id");
    accountSupportPartnerSales = zoho.crm.searchRecords("Sales_Orders","(Account_Name:equals:" + accountID + ")");
    for each srec in accountSupportPartnerSales {
    salesRecID = srec.get("id");
    <p><%=salesRedID%>
    }
    }



The first 'for each' function works, but the moment I add 'for each srec in accountSupportPartnerSales {' I get the error above.

Essentially, I am trying to:

1. Look for all Account records that have a particular value in the Support_Partner field.
2. Look up all Sales orders for accounts that have the particular value in the Support_Partner field.


As always, thank you community for your input!

    Access your files securely from anywhere

        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 Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • 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