Pass connection to use for a function as a parameter

Pass connection to use for a function as a parameter

Hello,

I basically have a custom function that does some CRM queries on  a specific Lead ID.  I basically call in my custom function:

  1. zoho.crm.searchRecords(....., "THE_CRM_CONNECTION_TO_USE")

Since i have a production environment and several sandboxes to test things on and i would like to reuse those functions everywhere I tried to pass in instead of the connection string a variable that i would get as a parameter to the function. Every time i tried to do that upon hitting the save function button i get an error telling me that the connection i provided doesn't exist "although i haven't specified it yet as it will be specified with the function would run. Here is an example:
  1. // this works when i  pass in the predefined connection string literally.
    void function test_dynamic_connection(int id) {
          zoho.crm.getRecordById("Leads", id, Map(), "MY_PREDEFINED_CRM_CONNECTION");
    }

    // This doesn't work when i pass it dynamically
    void function test_dynamic_connection(int id, string connection) {
          zoho.crm.getRecordById("Leads", id, Map(), connection);
    }


My question would be if there is a way to pass the connection dynamically so i can share my custom functions between different sandboxes ( each with it's own connection) or not.

Thanks in advance.

Regards,
K. Mansour
    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 コンテンツ




                              ご検討中の方