Syntax error that does not make sense.
Hi all,
I cannot fingure out where this syntax error is coming from. I need to add this to a workflow to update a Contact record Account field by matching the email domain with the website domain in the Account record. I found a solution using Zia Search but Compliance does not allow the use of AI where customer data is involved.
- void automation.AssociateContactsAccounts(int contactId) {
- try {
- contactRecord = zoho.crm.getRecordById("Contacts", contactId);
- if (contactRecord == null) {
- info "Contact record not found for ID: " + contactId;
- return;
- }
- contactEmail = contactRecord.get("Email");
- if (contactEmail != null && contactEmail.contains("@")) {
- emailDomain = contactEmail.split("@").get(1).toLowerCase();
- page = 1;
- accountsFound = false;
- while (accountsFound == false) {
- accounts = zoho.crm.getRecords("Accounts", page, 500);
- if (accounts.isEmpty()) {
- break;
- }
- for each account in accounts {
- accountWebsite = account.get("Website");
- if (accountWebsite != null && accountWebsite != "") {
- cleanDomain = accountWebsite.toLowerCase()
- .replace("http://", "")
- .replace("https://", "")
- .replace("www", "")
- .split("/").get(0);
- if (cleanDomain == emailDomain) {
- accountId = account.get("id");
- updateMap = Map();
- updateMap.put("Account_Name", accountId);
- response = zoho.crm.updateRecord("Contacts", contactId, updateMap);
- info "Contact linked to Account successfully: " + response;
- accountsFound = true;
- break;
- }
- }
- }
- page = page + 1;
- }
- if (accountsFound == false) {
- info "No matching Account found for email domain: " + emailDomain + " for Contact ID: " + contactId;
- }
- } else {
- info "Invalid or missing Email for Contact ID: " + contactId;
- }
- } catch (e) {
- info "Error in AssociateContactsAccounts: " + e.toString();
- }
- }
Failed to update function Syntax error. Expecting ';'. Found '{'. (Line : 17)
I am very new at this is its prabably dumb but I am not seeing it...
Any guidance would be appreciated.