Skip to Content
0
Sep 29 at 09:57 AM

Redwood Script to Set Application to the Jobs

96 Views

Hello Experts,

Kindly check the below code for setting the application of the job which is running fine however when persisted the changes are not applied. Kindly check and let me know if any modification is required in the code.

{

for (Iterator it = jcsSession.executeObjectQuery("select JobDefinition.* from JobDefinition where JobDefinition.MasterJobDefinition = JobDefinition.UniqueId and JobDefinition.Name like 'CUS_IBP%'", null); it.hasNext(); ) {

JobDefinition jobdef = (JobDefinition) it.next();

if (jobdef.getName() != null) {

try{

Partition p = jcsSession.getPartitionByName("GLOBAL");

Application app = jcsSession.getApplicationByName(p,null,"IBP_JOBS");

jobdef.setParentApplication(app);

jcsSession.persist();

jcsOut.println(jobdef.getName() + ": Application set");

}

catch (Exception e){

jcsErr.println(jobdef.getName() + ": Application could not be set");

}

}

}

}

Thanks in advance!!