I am trying to create a BPM to prevent a job from being firmed. This is to happen in Job Entry. When the user tries to click the “Unfirm” checkbox to turn it into a firm job, I have some logic to determine whether or not the job should be allowed to be firmed. Via tracing I found the following methods are called when the unfirmed checkbox is checked:
I tried to put the logic in CheckUnfirmJob but this did not seem right because it did not prevent the job from being firmed, so I wound up putting it in JobEntry.Update. The way I am preventing the job from firming is to throw an exception with a message indicating why the job cannot be firmed. This does work, but it leaves the screen in a bad state - if I try to check the “unfirm” checkbox again, it immediately succeeds in being checked, but nothing actually happens - the JobEntry.Update method is not called, and the job is not actually firmed. The screen also seems to be in a state where it wants to try to save the job state unexpectedly, which causes JobEntry.Update to be called again and the exception to be thrown again. For instance, if I simply try to click in any field under the tabs at the bottom such as “Make to Order” or “Demand Summary” it does this. I do not see this behavior before the exception is thrown, and if I click to refresh the record it makes the issue go away, but of course we do not want to get the screen in this bad state to begin with as the user should be able to continue working normally.
I am thinking that perhaps there is a different way I should prevent the job from being firmed - maybe I have to call another business method or something? What is the proper way to do this so the screen doesn’t get in a bad state after firming has been prevented?