Prevent Multiple Approved Revisions

The title says it all. I’m trying to create some logic to prevent someone from checking a revision approved while a different one remains approved. Essentially, this would force a person to unapprove the old revision before approving a new one. Or perhaps the logic could automatically mark any other approved revisions unapproved when marking a revision true.

In any event, I get stuck trying to interrupt that process when approving a revision. I throw an exception to “stop” the update from processing but it tries to proceed. It pops up the Change description box and then if I confirm that box, it still tries to save… only to popup my exception again. Then finally quits. Ideally, it would just throw the exception once without other wasted clicks and confusion.

Any tips for this?

I’m about to work on something similar. I was hesitant to make it a hard stop like that because we sometimes have to run out rev A while making rev B, and we could have internet orders theoretically hit in the minutes while no rev was approved.

However, if I do it I was thinking of hiding the
menu and placing a big red text warning on the screen based on a BAQ counting existing revs… bit of a hack but just FWIW…

Yeah I am about to hack it… I was hoping someone had a more elegant solution or idea. Unfortunately for us, it’s more common for someone to mistakenly approve/unapprove a revision than it is for us to phase something in/out intentionally.

I ended up creating a method directive on the Part.ChangePartRevApproved method. I looked at the ipApproved parameter passed to the method and if it was true, I set my OtherApproved variable to:

(from pr in Db.PartRev
where pr.Company == callContextClient.CurrentCompany
&& pr.PartNum == PartNum
&& pr.Approved == true
select pr).Any()

Then I passed that variable to a condition widget and if it was true, I raised an exception with a message. I then had to make a similar BPM on the EngWorkBench.CheckECORevApproved method for when a user tries to approve/check-in from there. I would’ve rather used a Data Directive since it would’ve covered all my bases but it was doing wacky things when I tried that… so I resorted to the method directives.

2 Likes