BizDock Scheduled script

This Plugin allows you to schedule some checks and action at regular interval, for exemple send an email with all the new Initiatives of the last day.

The Plugin can be instantiated many times so that you can manage different checks and actions.

Data Type

The BizDock Schedules script is using the same data types than BizDock Event handler.

Data exchange

Events

This Plugin does not listen to BizDock events.

Admin Commands

This Plugin does not provide any Admin Command.

Configuration

Parameters

  • start.time: define when the script should start (date time). Default value is 00h00.
  • frequency.in.minutes: define how regularly (in minutes) the script should run (integer). Default value is 1440 (one time per day).

Hook script

The script which will be run at the specified frequency.

The perform method

The permform method allows to define the checks/actions that would be done.

Signature
function perform(date)
Attributes
  • date: the date and time when the script is triggered.
Usage

Example to get by e-mail the Initiatives created during the last 7 days

function perform(date){
 
  var query=scriptUtils.createQuery("PortfolioEntry");
  var today=new Date();
  var current_date_minus_7_days=new Date(today.getTime() - 7*24*3600*1000);
  var clause=query.expr().between("creationDate",current_date_minus_7_days, new Date());
    var list=query.executeQuery(clause);
    var result="";
  	for (i = 0; i < list.size(); i++) {
    	result=result+list.get(i).name+"\n";
  	}
 
  scriptUtils.sendMail("New Initiatives", result ,"james@bond.co.uk");
}