ZOHO CRM Vaildate Field with Function
I want to validate the account status must to be "Inactive" when the opportunity's stage change to "Closed Won" or "Closed Lost", but my code is not working.
The module[opportunity] have field "Account Name", and I take the "Account Name" to get module[Accounts] field "Account Status".
This is my code:
- entityMap = crmAPIRequest.toMap().get("record");
- Stage = entityMap.get("Stage");
- RecAccount = zoho.crm.getRecordById("Accounts",entityMap.get("Account_Name"));
- AccountStatus = RecAccount.get("Account_Status");
- response = Map();
- if(AccountStatus != "Active")
- {
- response.put("status",'error');
- response.put('message','Account Status is not Active');
- }
How could I debug?
The error message is say "Someting went wrong, Please check your function for any possible failed case"