getJSON not working consistantly
Hi,
I have created two custom functions that leverage getURL. One of them brings back Account details based on domain name and the other brings back contact details based on email address.
for the Account details custom function it getJSON works perfectly, and I have no issues:
- HeaderMapVariable=map();
- HeaderMapVariable.put("Authorization","Bearer 8wwtw422626sshsh4466");
- respMap = getUrl(("https://company.clearbit.com/v2/companies/find?domain=") + input.aDomain,HeaderMapVariable);
- //description//
- responseSite=respMap.getJSON("site");
- sitedesc=responseSite.getJSON("metaDescription");
- //techs//
- techs=respMap.getJSON("tech");
- //sector//
- responseCategory=respMap.getJSON("category");
- sector=responseCategory.getJSON("sector");
- industryGroup=responseCategory.getJSON("industryGroup");
- //address//
- responseAddress=respMap.getJSON("geo");
- streetNumber=responseAddress.getJSON("streetNumber");
- streetName=responseAddress.getJSON("streetName");
- city=responseAddress.getJSON("city");
- stateCode=responseAddress.getJSON("stateCode");
- postalCode=responseAddress.getJSON("postalCode");
- countryCode=responseAddress.getJSON(("countryCode"));
- streetAddress=streetNumber + " " + streetName;
- //phone//
- responsePhone=respMap.getJSON("phone");
- //update Account Record//
- updatedresponse = zoho.crm.updateRecord(("Accounts"),(input.aAccountID).toString(),{ "Description" : sitedesc, "Technologies" : techs, "Sector" : sector, "Billing Code" : postalCode, "Billing Country" : countryCode, "Billing Province" : stateCode, "Billing City" : city, "Phone" : responsePhone.toString(), "Industry" : industryGroup, "Billing Address" : streetAddress });
For the Contact details I keep getting and error when trying to save:
No able to find 'getJSON' function:
- HeaderMapVariable=map();
- HeaderMapVariable.put("Authorization","Bearer 8eter21adgha828402bskgks");
- respMap = getUrl(("https://person.clearbit.com/v2/people/find?email=") + input.cEmail,HeaderMapVariable, false);
- //name//
- rName=respMap.getJSON("name");
- gName=rName.getJSON("givenName");
- fName=rName.getJSON("familyName");
- //job//
- responsesJob=respMap.getJSON("employment");
- accountName=responsesJob.getJSON("name");
- jobTitle=responsesJob.getJSON("title");
- role=responsesJob.getJSON("role");
- //twitter//
- responseTwitter=respMap.getJSON("twitter");
- twitterHandle=responseTwitter.getJSON("handle");
- twitterPic=responseTwitter.getJSON("avatar");
- //description//
- description=respMap.getJSON("bio");
- //update Account Record//
- updatedresponse = zoho.crm.updateRecord("Contacts",input.cContactId.toString(),{ "Title" : jobTitle, "Description" : description});
Why does getJSON function work on the first custom function but not the second?
Thanks,
Zack