I am creating my first Zoho function (but I am not a programmer!). I've been trying to copy examples in the documentation. I've hit some problems with syntax.
The function is triggered when a ticket is created in Desk from an incoming email with a certain subject. What I aim to do is to create an activity record, scheduling a call for the next day. The call is to be associated with the Lead and the owner of the lead.
Issue 1
----------
In order to get the Lead Id, I've been trying to get it using the from email address on the ticket, passed as a parameter to the function. This is my attempt:
leadDetails = zoho.crm.searchRecords("Leads", "(Email:equals:input.email)");
leadId = 0; // Cast leadId as BIGINT
leadId = leadDetails.get("id").toLong();
However, I get an error message associated with the last statement: 'TEXT' can not be cast to '[BIGINT]' for the function 'get'
I'm not sure whether this is the best way to do this or, in fact that I could have somehow access the Id of the Lead record from the ticket that is being created, but it was the easiest way I could see from examples I found.
Issue 2
----------
I want to create the call record based on the setting of a fileld in the Lead record. This is my attempt:
leadFollowUp=ifnull(leadDetails.get("Follow Up"), "");
if (leadFollowUp != "Yes") //do not create if already a follow-up
{
{
There are statements between the curly brackets but I've left them out for clarity.
Of the above
- the first statement has the same 'TEXT' can not be cast to '[BIGINT]' for the function 'get' issue
- the second statement (the if statement`} flags with improper statement. (all my if statements have the same problem!)
Issue 3
----------
Actually, just more examples of 'TEXT' can not be cast to '[BIGINT]' for the function 'get'. However, not sure whether there may be other ways I need to address these statements
mp.put("SMOWNERID", ifnull(leadDetails.get("SMOWNERID"), ""));
leadClassification=ifnull(leadDetails.get("Lead Classification"), "")
All the rest seems to validate OK. As I said, I am not a programmer, but I can copy and paste examples!!!