Saturday, February 28, 2015

Adding parameters in crontask

The below steps we need to follow : 

Step 1. import psdi.app.system.CrontaskParamInfo;
Step 2. import java.rmi.RemoteException;
Step 3:
public class CustomCronTask  extends SimpleCronTask{

 public CrontaskParamInfo[] getParameters() throws MXException,RemoteException
{
   CrontaskParamInfo parameters[] = new CrontaskParamInfo[2];
   parameters[0] = new CrontaskParamInfo();
   parameters[0].setName("Parameter 1");
   parameters[1] = new CrontaskParamInfo();
   parameters[1].setName("Parameter 2");
   return parameters;

}
}
Step 4: ***** This is very important *****
        i) If it is a new crontask, after creating an instance, parameters will display on the screen.
        ii) If you are adding parameters to the existing crontask, then you have to create a new crontaskinstance and save the record. Then parameters will display on the screen.

No comments:

Post a Comment