Manage Scheduled Tasks

This feature is available only in Enterprise Edition.

Monitor and manage scheduled tasks using the :schedule or equivalent :sch command. This command has actions to add, edit, run, and remove schedule tasks, as well as actions to get the current status of schedule tasks.

Run the command using the Administration Console. (See Connect to a Repository for information on how to access the Console.) Only Site Administrators can access tasks for organizations that are not currently connected through the Administration Console. (See Create an Organization for more information about administrator roles.)

Optional parameters should be provided in a key-value pair with a preceding double-hyphen (--). For example: --organizationid organization0.

List Scheduled Tasks

The list action returns a list of all schedule tasks. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional)

Example

:schedule list --organizationid organization0

Create a New Scheduled Task

The add action creates a new scheduled task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task to create.

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional)

conditions

The name of a variable containing a Groovy List of inetsoft.enterprise.web.api.schedule.ScheduleCondition instances. The ScheduleCondition structure can be generated using the DSL. (See Groovy DSL Framework for more information.)

actions

The name of a variable containing a Groovy List of inetsoft.enterprise.web.api.schedule.ScheduleAction instances. The ScheduleAction structure can be generated using the DSL. (See Groovy DSL Framework for more information.)

options

An optional scheduleOptions structure. See example below.

Example

import inetsoft.shell.dsl.Schedule
import java.time.OffsetDateTime
import inetsoft.sree.security.IdentityID
import inetsoft.enterprise.web.api.schedule.ScheduleTask
conditions = [
  Schedule.timeCondition {
    type 'AT'
    date OffsetDateTime.parse('2019-01-01T00:00:00Z')
  },
  Schedule.completionCondition {
    task 'Task1'
    owner 'admin'
  }
]
ems = [ 'joe@inetsoft.com', 'annie@inetsoft.com' ]
adminUser = new IdentityID('admin', 'organization0')
actions = [
  Schedule.viewsheetAction {
    viewsheet '1^128^__NULL__^Examples/Census^organization0'
    bookmarkName '(Home)'
    bookmarkNames(['(Home)'])
    bookmarkUsers([adminUser])
    bookmarkType 'all_share'
    bookmarkTypes(['all_share'])
    emails ems
    sender 'reportserver@inetsoft.com'
    format 'PDF'
    subject 'Monthly Earnings'
    emailLink true
    message 'Please review and take the necessary actions prior to month end.'
  }
]
options = Schedule.scheduleOptions {
  enabled true
  deleteIfNotScheduledToRun false
  startDate OffsetDateTime.parse('2020-02-01T00:00:00Z').toInstant().toEpochMilli()
  endDate OffsetDateTime.parse('2099-01-01T00:00:00Z').toInstant().toEpochMilli()
  description 'admin test description'
  locale 'Default'
  executeAsID new ScheduleTask.ExecuteAsID(ScheduleTask.ExecuteAsID.Type.USER, adminUser)
}
:schedule add Task admin conditions actions --options options --organizationid organization0

Get Information About Scheduled Task

The get action returns information about an existing scheduled task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional)

Example

:schedule get 'My Task' admin --organizationid organization0

Modify Scheduled Task Properties

The update action allows you to modify the properties of an existing scheduled task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

task

The name of a variable that contains an inetsoft.enterprise.web.api.schedule.ScheduleTask instance. The ScheduleTask structure can be created using the DSL. (See Groovy DSL Framework for more information.)

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional, must be final parameter if present)

Example

Rename “My Task” to “New Name” and disable it.
import inetsoft.shell.dsl.Schedule
import inetsoft.sree.security.IdentityID
def ownerID = new IdentityID("admin", "host-org")
def task1 = Schedule.task {
  name 'New Name'
  owner ownerID
  description 'test update'
  enabled false
}
:sch update 'My Task' admin  task1 --organizationid organization0

Remove Scheduled Task

The remove action deletes an existing scheduled task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional)

Example

:schedule remove 'My Task' admin --organizationid organization0

Get Status of Scheduled Task

The status action returns the status of a scheduled task. This can also be obtained from the list action above. (See List Scheduled Tasks.) Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional)

Example

:schedule status 'My Task' admin --organizationid organization0

Run Scheduled Task

The run action executes a scheduled task. Note: You must first connect to a repository. See Connect to a Repository. After you run the task, use the status action to determine whether the task is complete. (See Get Status of Scheduled Task.)

Parameter

name

The name of the task.

owner

The owner of the task

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional)

Example

:schedule run 'My Task' admin --organizationid organization0

List Scheduled Task Conditions

The list-conditions action returns the conditions assigned for a task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional)

Example

:schedule list-conditions 'My Task' admin --organizationid organization0

Add New Condition to Scheduled Task

The add-condition action applies a new condition to a schedule task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

condition

The name of a variable that contains an inetsoft.enterprise.web.api.schedule.ScheduleCondition object that defines the condition to be added. The ScheduleCondition structure can be created using the DSL. (See Groovy DSL Framework for more information.)

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional, must be final parameter if present)

Example

import inetsoft.shell.dsl.Schedule
import java.time.OffsetDateTime
def condition = Schedule.timeCondition {
  type 'AT'
  date OffsetDateTime.parse('2019-01-01T00:00:00Z')
}
:schedule add-condition 'My Task' admin  condition --organizationid organization0

Get Information About Scheduled Task Condition

The get-condition action returns information about an existing task condition. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

index

The zero-based index of the condition.

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional, must be final parameter if present)

Example

:schedule get-condition 'My Task' admin  0 --organizationid organization0

Modify Scheduled Task Condition

The update-condition action allows you to modify an existing condition of a schedule task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

index

The zero-based index of the condition.

condition

The name of a variable that contains an inetsoft.enterprise.web.api.schedule.ScheduleCondition object that defines the updated condition properties. The ScheduleCondition structure can be created using the DSL. (See Groovy DSL Framework for more information.)

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional, must be final parameter if present)

Example

import inetsoft.shell.dsl.Schedule
import java.time.OffsetDateTime
def condition = Schedule.timeCondition {
  type 'AT'
  date OffsetDateTime.parse('2019-01-01T00:00:00Z')
}
:schedule update-condition 'My Task' admin  0 condition --organizationid organization0

Remove Condition from Schedule Task

The remove-condition action removes an existing condition from a schedule task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

index

The zero-based index of the condition.

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional, must be final parameter if present)

Example

:schedule remove-condition 'My Task' admin  1 --organizationid organization0

List Actions of Scheduled Task

The list-actions action returns the actions performed by a scheduled task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional)

Example

:schedule list-actions 'My Task' admin --organizationid organization0

Add New Action to Scheduled Task

The add-action action allows you to add a new action to a schedule task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

action

The name of a variable that contains an inetsoft.enterprise.web.api.schedule.ScheduleAction object that defines the updated action properties. The ScheduleAction structure can be created using the DSL. (See Groovy DSL Framework for more information.)

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional, must be final parameter if present)

Example

import inetsoft.sree.security.IdentityID
import inetsoft.shell.dsl.Schedule
adminUser = new IdentityID("admin", "host-org")
def ems = ['sarapeng@inetsoft.com']
def action2 = Schedule.viewsheetAction {
viewsheet '1^128^__NULL__^Examples/Census^host-org'
bookmarkName '(Home)'
bookmarkNames(['(Home)'])
bookmarkUsers([adminUser])
bookmarkType 'all_share'
bookmarkTypes(['all_share'])
emails ems
sender 'reportserver@inetsoft.com'
format 'EXCEL'
subject 'updated'
message 'updated'
}
:sch add-action 'My Task' admin  action2 --organizationid organization0

Get Information About Scheduled Task Action

The get-action action returns information about an existing action. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

index

The zero-based index of the action.

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional, must be final parameter if present)

Example

:schedule get-action 'My Task' admin 0 --organizationid organization0

Modify Scheduled Task Action

The update-action action allows you to modify an existing action of a schedule task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

index

The zero-based index of the action.

action

The name of a variable that contains an inetsoft.enterprise.web.api.schedule.ScheduleAction object that defines the updated condition properties. The ScheduleAction structure can be created using the DSL. (See Groovy DSL Framework for more information.)

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional, must be final parameter if present))

Example

import inetsoft.sree.security.IdentityID
import inetsoft.shell.dsl.Schedule
adminUser = new IdentityID("admin", "host-org")
def ems = ['user1@inetsoft.com']
def action2 = Schedule.viewsheetAction {
  viewsheet '1^128^__NULL__^Examples/Census^host-org'
  bookmarkName '(Home)'
  bookmarkNames(['(Home)'])
  bookmarkUsers([adminUser])
  bookmarkType 'all_share'
  bookmarkTypes(['all_share'])
  emails ems
  sender 'reportserver@inetsoft.com'
  format 'EXCEL'
  subject 'updated'
  message 'updated'
}
:schedule update-action 'My Task' admin  0 action2 --organizationid organization0

Remove Action from Scheduled Task

The remove-action action removes an existing action from a schedule task. Note: You must first connect to a repository. See Connect to a Repository.

Parameter

name

The name of the task.

owner

The owner of the task

index

The zero-based index of the action.

organizationid

Organization ID for multi-tenant environment. (See Enable Multi-Tenancy.) (optional, must be final parameter if present))

Example

:schedule remove-action 'My Task' admin  1 --organizationid organization0