cancel
Showing results for 
Search instead for 
Did you mean: 

Redwood Script to Set Application to the Jobs

Gabie
Explorer
0 Kudos

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!!

Accepted Solutions (1)

Accepted Solutions (1)

gmblom
Active Contributor
0 Kudos

hello,


two items:

1) did the application lookup actually find something?

2) you could do the application lookup (before) and the persist (after) outside of the loop

Regards Gerben

Gabie
Explorer
0 Kudos

Thanks Gerben

Answers (0)