cancel
Showing results for 
Search instead for 
Did you mean: 

Parameter Addition in Bulk

Former Member
0 Kudos

Hi,

Could you let me know if there is a way in redwood to add a parameter to all the existing jobs jobs in a system at once.

Regards,

Veena.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Veena,

following code you can use for updating one parameter of one job Definition.

the same you can loop thru all the jobs that are scheduled and update for all existing jobs.

{

boolean t = true;

boolean f = false;

JobDefinition jobdef = jcsSession.getJobDefinitionByName("Job Definition Name");

JobDefinitionParameter jobdefparam;

if (jobdef != null )

{

jcsOut.println(jobdef.getName());

//Parameter Name

jobdefparam = jobdef.getJobDefinitionParameterByName("Parameter Name");

if (jobdefparam == null )

{

JobDefinitionParameter jdp = jobdef.createJobDefinitionParameter();

jdp.setName("Parameter Name");

jdp.setDefaultExpression("Parameter Value");

jdp.setDisplayOrder(new Long(200));

jdp.setDirection(ParameterDirection.In);

jdp.setDataType(ParameterType.String);

jcsOut.println(jdp.getName());

jcsSession.persist();

}

else {jcsOut.println("Job Name Not Found");}

}

}