cancel
Showing results for 
Search instead for 
Did you mean: 

Redwood script to change the Error status to Completed

Former Member
0 Kudos

Currently  processing a job which fails via a CPS System kill for each run. CPS/Redwood Guides states that the Error status can be change to Completed  in the Job Definition Actions Tab with the Post Running Option via a Redwood Script. Looking for a layout or a working example of the script.

Accepted Solutions (0)

Answers (1)

Answers (1)

h_carpenter
Active Contributor
0 Kudos

Hi Larry,

I would be curious to know where in the documentation it is mentioned that you can set the final status of a job that has been killed. This should not be possible. Killing a job should be something out-of-the-ordinary, not something you do regularly. The real solution to your problem is improving the code that is run when your job is running (the code in the job definition) to exit early if something goes wrong.

When you kill a job, you interrupt all processing, even the post-running action.

If this job is in a chain, you can use status handlers there to mark the chain Completed, even if you killed the job inside the chain.

As for setting the final status in a post running action, you could use something like this, however (!), this will not work for killed jobs:

{

  if (<myCondition>)

  {

     jcsPostRunningContext.setFinalStatus(JobStatus.Completed);

  }

}

Where myCondition is some condition, for example:

JobStatus.Error.equals(jcsJob.getStatus())

Regards,

HP