I'm a newcomer to Deluge and am really struggling to get the below script to work.
I want it to use a for each loop to look through several fields on the Account record, and then, assuming there is a value in the field, user the proper function to capitalise it, and then update the record. So if the street name value is 'example street' the script corrects it to 'Example Street'.
accountsCase = zoho.crm.getRecordById("Accounts",account_id);
// get the fields I want to run through the for each loop
accountName = accountsCase.getJSON("Account_Name");
postCode = accountsCase.getJSON("Billing_Code");
billStreet = accountsCase.getJSON("Billing_Street");
billProv = accountsCase.getJSON("Billing_Province");
billStreet2 = accountsCase.getJSON("Street_2");
billCity = accountsCase.getJSON("Billing_City");
addressColl = Collection(accountName, billStreet, billStreet2, billCity, billProv, postCode);
finalDetails = Collection();
for each data in addressColl
{
if(!isnull(data))
{
data = data.proper();
finalDetails.insert(data);
}
}
info finalDetails;
zoho.crm.updateRecord("Accounts",account_id,finalDetails);