Question about CRM API
Question about CRM API
Hi there. I'm new on Zoho.
I am creating an application (from Zoho Creator) that should extract a list of account names from the CRM module. The data should be taken and used to pre-populate a drop down list when the form is loaded.
The code I'm using is as follows:
- responseStr = getUrl(("http://accounts.zoho.com/login?servicename=ZohoCRM&FROM_AGENT=true&LOGIN_ID=MY_USERNAME&PASSWORD=MY_PASSWORD"));
- startingIndex = ((responseStr).indexOf("TICKET=") + 7);
- endIndex = (responseStr).indexOf("RESULT");
- ticketStr = (responseStr).subString(startingIndex,(endIndex - 1));
- m = map();
- xmlString = postUrl((("http://crm.zoho.com/crm/private/xml/Accounts/getRecords?newFormat=2&apikey=MY_API_KEY&ticket=") + ticketStr) + "&sortColumnString=Account Name&sortOrderString=asc", m);
- accountNameListStr = xmlString.executeXPath("/response/result/Accounts/row/FL[@val=\"Account Name\"]/text()");
- accountNameList = accountNameListStr.toList("-|-");
- for each name in accountNameList
{
accounts:ui.add(name);
}
If I hardcode on the script the values of MY_USERNAME, MY_PASSWORD and MY_API_KEY, the form pre-populates the drop down list when it is loaded, but I don't want to hardcode these values on the script.
I want to know:
1) Is it possible to get the API Key value dynamically from the Deluge script?
2) I know I can get the username from the variable "zoho.loginuser", but from the script, how can I get the password value? Is it possible to get it (somehow) without hardcoding it?
3) Is it possible to pass those values to the form so they can be accessed before the form loads?
Thanks in advance.