I'm trying to write a code that'll automatically run when a contact is created. It'll take the postcode and use that with my Google Geocoding API to pull the street and city, and put that in the Address field.
leadDetails = zoho.crm.getRecordById("ARCH_Concept_Ltd",input.leadId);
// Make API call to Google Maps Geocoding API
api_key = "API_Number";
postcode = ifnull(leadDetails.get("Postcode"),"");
api_url = "https://maps.googleapis.com/maps/api/geocode/json?address=" postcode "&key=" api_key;
response = http.get(api_url.toURL());
// Parse the response to extract the street address
data = json.parse(response.getContent());
address = data.results[0].formatted_address;
// Store the address in the "Address" field
mp = Map();
mp.put("Address",address);
update = zoho.crm.updateRecord("ARCH_Concept_Ltd",leadId.toLong(),mp);
info mp;
info update;
I'm getting the following error:
Failed to save the function Syntax error. Expecting executeshellscript task,expression,invokeurl task or 'invokeintegration'. Found '['. Line Number: 11
CodePudding user response:
The error message says it is expecting executeshellscript task,expression,invokeurl task or 'invokeintegration'.
.
Although it says the error is at the '[' on line 11
, that is just where the interpreter finally gave up.
This line: response = http.get(api_url.toURL());
can be replaced with zoho-Deluge's invokeurl
command so give that a try.