Hi Jason,Good question. I'll need to think that over.@Steve Lee and @Steven Shull talk about the possible downside to suppressing WO statuses from the selection list in a related post:Prevent WO from being completed if tasks are incomplete?"This may not be what the customer wants however as the users may question WHY the COMP status is not in the list. The other cleaner option is to add this validation in a workflow process or automation script where again check the count of open tasks being equal to 0 and if returns FALSE then display an error message to the user explaining why they cannot change the status to COMP.""...can be painful from a user perspective. We get support tickets quite a bit where the customer is trying to understand why user A can complete WO X but can't complete WO Y and it's because they have a condition on the status that requires something that the user hasn't provided and doesn't know to provide. While it requires writing an automation script, you can provide the user descriptive messaging around what's wrong and how to fix it."
Prevent CM WOs from being closed if the WO doesn't have any actuals
Hint: (I borrowed the query from our WO workflow)
exists (select 1 from matusetrans where refwo=:wonum)
or exists (select 1 from labtrans where refwo =:wonum)
or exists (select 1 from servrectrans where refwo=:wonum)
or exists (select 1 from tooltrans where refwo =:wonum)
An untested solution/script:
1. Create a new message:
- Go to Database Configuration, select Action 'Messages'
- Click New Row, enter below:
group = workorder
key = noActualFound
value = Can't close work order. Actuals are missing.
- Click OK.
2. Create below object launch point automation script 'WOCLOSE' with launch point object workorder, event Save-Update.
from psdi.mbo import Mbo
from psdi.mbo import MboRemote
from psdi.mbo import MboSet
from psdi.mbo import MboSetRemote
from psdi.util import MXApplicationException
status = mbo.getString("status")
worktype = mbo.getString("worktype")
wonum = mbo.getString("wonum")
if (worktype=='CM' and status=='CLOSE' and actMatSet.isEmpty() and actLabSet.isEmpty() and actSrvSet.isEmpty() and actToolSet.isEmpty()) :
Here's a related post. Maybe it could be changed to work with PRs instead of POs.Prevent Work Order With Open PO From Closing With Automation Script