cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rule for delaying scheduled task

Rule for delaying scheduled task

Enterprise level, mostly IdM system undergo one (or) another dependency application changes (Such as patching, upgrade, DR etc.,) Aggregations will fail due to unavailability/Connection issue of target system. To avoid these failures delaying aggregation is an only option. but delaying aggregation is a manual task & requires certain amount of time. Below Rule Runner Task will help to delay scheduled aggregation task by reducing manual effort.

 

 

Step 1:

Create a Custom file & specify Task Schedule which needs to be delayed

 

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Custom PUBLIC "sailpoint.dtd" "sailpoint.dtd">

<Custom name="Task-Schedule-Custom">

  <Attributes>

    <Map>

      <entry key="TaskSchedule">

        <value>

          <List>

//mention important task schedules (Name of Task Schedules, not Task definition) that needs to be delayed

            <String>Task-Schedule-1</String>

            <String>Task-Schedule-2</String>

           <String>Task-Schedule-3</String>

          </List>

        </value>

      </entry>

    </Map>

  </Attributes>

</Custom>

 

 

Step 2:

Below is rule where actually business logic resides.

 

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">

<Rule  language="beanshell" name="Task Schedule Automation">

  <Source>

        import java.util.List;

import sailpoint.object.*;

import sailpoint.object.TaskDefinition;

  import java.util.Date;

 

//Getting Custom file into rule

Custom taskObj = context.getObjectByName(Custom.class,"Task-Schedule-Custom");

List schedule = taskObj.get("TaskSchedule");

 

//iterating list of Scheduled task which mentioned in Custom file

for (String taskschedule : schedule)

  {

    TaskSchedule tasksch =(context.getObjectByName(TaskSchedule.class,taskschedule));

 

//setting how much time wanted to delay

Date date=new Date();

date.setSeconds(172800);

 

//setting the delay time in seconds (i.e, 172800 = 48 hours)

  tasksch.setNextExecution(date);

context.saveObject(tasksch);

context.commitTransaction();

  }

  return "Success";

    </Source>

</Rule>

 

Step 3:

 

After importing both the xmls, Create new Rule Runner task (Setup--> Task--> New Task --> Run Rule ) & select Rule (Task Schedule Automation) from drop down & Click on save & execute (only you wanted to delay the task schedule).​

Labels (2)
Version history
Revision #:
3 of 3
Last update:
‎Jul 03, 2023 12:13 PM
Updated by:
 
Contributors