Manage Scanning Tasks Using the UI

The task scanner queries a set of managed objects, then executes a script on the objects returned in the query result. The scanner then sets a field on a specific managed object property to indicate the state of the task. Before you start, you must set up this object type property on the managed user object.

In the example that follows, the task scanner queries managed user objects and returns objects whose sunset property holds a date that is prior to the current date. The scanner then sets the state of the task in the task-completed field of the user's sunset property:

  1. Select Configure > Schedules and click Add Schedule.

  2. Enable the schedule, and set the times that the task should run, as for any other schedule.

  3. Under Perform Action, select "Execute a script on objects returned by a query (Task Scanner)".

  4. Select the managed object on which the query should be run, in this case, user.

  5. Build the query that will be run against the managed user objects.

    The following query (based on the example schedule available in /path/to/openidm/samples/example-configurations/task-scanner) returns all managed users whose sunset date is prior to the current date (${Time.now}) and for whom the sunset task has not already completed (${taskState.completed} pr):

    ((/sunset/date lt \"${Time.now}\") AND !(${taskState.completed} pr))
  6. In the Object Property Field, enter the property whose values will determine the state of the task, in this case sunset.

  7. In the Script field, enter an inline script, or a path to the file containing the script that should be launched on the results of the query.

    The sample task scanner runs the following script on the managed users returned by the previous query:

    var patch = [{ "operation" : "replace", "field" : "/active", "value" : false },{ "operation" : "replace", "field" : "/accountStatus", "value" : "inactive" }];
    openidm.patch(objectID, null, patch);

    This script essentially deactivates the accounts of users returned by the query by setting the value of their active property to false.

  8. (Optional) Configure the advanced properties of the schedule described in "Configure Schedules".

Read a different version of :