This example will show you how to use an on save script to add a task to your system when a value in a specified field is changed.
Add Task
// The first line specifies the field you want the script to depend on [Changed.CustomField(6364).Changed] function on_save() { // Here you can specify the value that you wish to trigger the first task if(Changed.CustomField("6364").NewValueAsNumber <= 50){ // The format for adding as task is: Description, Note, Assigned User, Number of days until task is due Service.AddTask("Blacklist Client", "Suspend client license", Service.Case.FeeEarner, 7); Service.AddMessage("Task successfully added", "notify-success"); // return true specifies that the data created by the script will be saved to the system when it has been run return true; // This section specifies the alternative value that will trigger the second task as well as the content of that task } else if(50 < Changed.CustomField("6364").NewValueAsNumber < 100){ Service.AddTask("Reinstate Client", "Reinstate client license", Service.Case.FeeEarner, 7); Service.AddMessage("Task successfully added", "notify-success"); return true; // The section below creates an error message that will be send if the value in the field is invalid // i.e it does not meet the criteria for either task to be created } else { Service.AddMessage("An error occurred while adding task", "notify-error"); // return false means that the data create will not be saved to the system // in this case it means that the error message will be displayed, but not saved. return false; } }