Zoho ‐ Helpful Code Snippets - deptster/deptster.github.io GitHub Wiki

Get the Active Users based on Role Name in Zoho CRM

roleName = "'Role Name'";
queryMap = Map();
queryMap.put("select_query", "select id, first_name, last_name, role.name, status from users where ((role.name="+roleName+") and (status = 'active'))");
response = invokeurl
[
	url :"https://www.zohoapis.in/crm/v6/coql"
	type :POST
	parameters: queryMap.toString()
	connection:"userconn"
];
info response;

Generate a Dynamic list in Zoho CRM

calc = 5;
v_GeneratedList = leftpad(" ", calc).replaceAll(" ",",");
l_GeneratedList = v_GeneratedList.toList();
loopList = List();
for each index v_Index in l_GeneratedList
{
	if(v_Index>0)
	{
		loopList.add(v_Index);
	}
}
info loopList;

Get Current Date Time and put it in a date time field

dateValue = zoho.currenttime;
info toString(dateValue, "yyyy-MM-dd'T'hh:mm:ss+05:30", "IST");