Changing the contact owner
I'm trying to write a custom function where record ownership can change. This seems to me it should work:
Client = zoho.crm.getRecordById("Contacts",input.ClientID);
if(Client.get("Sales Status") != "Sold")
{
Reg=Client.get("Region");
if(Reg.startsWith("NorthEast") && (Client.get("Client Owner") != "Tom Brady"))
{
NewOwner="Tom Brady";
}
else if(Reg.startsWith("SouthEast") && (Client.get("Client Owner") != "Bill Belichik"))
{
NewOwner="Bill Belichik";
}
else
{
NewOwner="Some Other Cheater";
}
resp = zoho.crm.updateRecord("Contacts",input.ClientID.toString(),{ "Client Owner" : NewOwner });
}
Thanks in advance!