Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 3 Next »

Update Case Information
// The first line specifies the field you want the script to depend on
[Changed.CustomField(6364).Changed]
function on_save() {
// The section below specifies a case field and the value it should be changed to if
// the custom field holds a value below 50
    if (Changed.CustomField("6364").NewValueAsNumber <= 50) {
// The format for updating case information is "Service.UpdateCaseInfo("Field Name", "Value")"
        Service.UpdateCaseInfo("status", "close");
        Service.AddMessage("Case info successfully updated", "notify-success");
        return true;
// The section below specifies the alternative value if the custom field holds a value above 50
    } else if (50 < Changed.CustomField("6364").NewValueAsNumber < 100) {
        Service.UpdateCaseInfo("status", "open");
        Service.AddMessage("Case info successfully updated", "notify-success");
        return true; 
// The script below triggers an error message if neither of the conditions above are satisfied.
    } else {
        Service.AddMessage("An error occurred while updating case info", "notify-error");
        return false;
    }
}

  • No labels