thisViewsheet.scheduleAction(Boolean[,emails])

Specifies whether the Dashboard should be executed as part of a scheduled task. This allows you adapt scheduled task execution based on conditions at runtime. Set to true to allow the Dashboard to run as scheduled. Set to false to override the scheduled task setting and suppress Dashboard execution. See Schedule a Dashboard in Use the Portal and Schedule in Manage the Server for more information about scheduling.

Parameters

Boolean

true (default): execute task, false: do not execute task

emails

Array of emails

You can use the scheduleAction function to conditionalize the execution of a scheduled Dashboard task based on actual Dashboard data. Use the optional second parameter, emails, to dynamically set the list of emails for the ‘Deliver To Emails’ scheduled action. Use thisViewsheet.taskName to obtain the name of the currently executing task.

The email list that you provide in the emails array supersedes any emails specified on the Scheduler Action tab (both for user-scheduled tasks and administrator-scheduled tasks), and automatically enables the ‘Deliver To Emails’ task action.

While the scheduleAction function facilitates the creation of “alerts”, an easier method of setting alerts is also available. See Create Alert in Manage the Server and Schedule a Dashboard in Use a Dashboard for more information.

Examples

The following script uses the value of a Gauge component to determine whether the Dashboard task should execute as scheduled.

Evaluate dashboard for execution
if (Gauge1.value > 10000) {
  thisViewsheet.scheduleAction(true)
}
else {
  thisViewsheet.scheduleAction(false)
}

If the scheduled action is a user notification (for example), then the user will receive the alert only when the value of the Gauge component exceeds the threshold.

Evaluate dashboard for execution and deliver emails
if (Gauge1.value > 10000) {
  emails = ['joe@inetsoft.com', 'sue@inetsoft.com', 'mark@inetsoft.com'];}
else {
  emails = ['joe@inetsoft.com'];
}
thisViewsheet.scheduleAction(true, emails);