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:
- 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:
- // 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