How can any user send an e-mail with changes in a field, when the field is modified
I wrote the following script to send an e-mail with the changes made in a field (Product) when this field is modified. So far is working fine, however only when the admin makes the changes to the field the e-mail is successfully sent. When another user tries to make a change in the field "Product", the e-mail is not sent. Any solutions?
ON EDIT > VALIDATE
changed_values = map();
if (input.Product != old.Product)
{
changed_values.put("New Product", input.Product);
changed_values.put("Old Product", old.Product);
}
if (!changed_values.isEmpty())
{
input.change = changed_values.toString();
}
ON EDIT > ON SUCCESS
if (input.change != "")
{
changed_fields = input.change.toMap();
input.change = "";
changed_fields_keys = changed_fields.keys();
changed_fields_keys.sort();
changed_fields_list = "";
for each field in changed_fields_keys
{
changed_fields_list = (changed_fields_list + field + ": " + changed_fields.get(field)) + "<br>";
}
sendmail
(
To : zoho.adminuserid
From : zoho.adminuserid
Subject : "The Product has been modified"
Message : changed_fields_list + "<br type=\"_moz\" />"
)
}