I have a job which executes a PowerShell. Upon failure it is set to resubmit 1 time after 1 minute wait. That works fine. If I set the job to execute a JS to set job as complete upon fail, that works fine (code I am using below). The problem happens when I use them both. It sets the job as "Auto-Resubmit Failed Job = Yes" then marks it complete, so the second execution does not happen. How can I trap that the job will be auto-resubmitted and not do the force completion until all retries have been executed still leaving a failure?
execCommand('%(WOB._fullname)','%(APPL._name).%APPL._gen', 'ACTION COMPLETE');
This seems to have handled the issue. Putting here for others if needed.
if (WOB._cmpc != null && WOB._subcount > WOB._retrycount)