View Only
  • 1.  Prevent closing WO with open PR?

    Posted Thu July 22, 2021 12:30 PM

    Is there an OOB way to prevent closing a WO if the WO has an open PR?

    Similar to this, but for PRs instead of POs:
    Prevent Users From Closing Work Orders With Open PO


  • 2.  RE: Prevent closing WO with open PR?

    IBM Champion
    Posted Fri July 23, 2021 11:18 AM
    Do you need a dialog box to warn users why they can't close the WO or just suppress the WO status from the selection list?

    Jason Verly
    Reliability Engineering Manager
    Agropur US
    Le Sueur MN

  • 3.  RE: Prevent closing WO with open PR?

    Posted Fri July 23, 2021 11:28 AM
    Is there a reason why you need the users to manually close work orders?  I ask because I usually just set up an escalation to do it, and then tell the users that they're responsible for getting the work order to COMP status.

    So none of the users have rights to close them.  The escalation checks for open PRs and POs, of course, before it closes a work order.

    Shannon Rotz
    InComm Solutions
    New Westminster BC

  • 4.  RE: Prevent closing WO with open PR?

    Posted Thu July 29, 2021 11:39 AM

    Hi Shannon,

    It's a good question. I agree that users shouldn't need to manually close WOs. 

    From our perspective, we don't have the manpower to change how the organization operates. The setup you described might not be hard from a technical perspective, but from an business process perspective, it would take a lot of effort & meetings to make that change.

    Whereas adding functionality that prevents closing a WO if there is an open PR/PO is something we can implement without changing our business process.

    Ideally, we will use your method in the future.

  • 5.  RE: Prevent closing WO with open PR?

    Posted Fri July 23, 2021 12:53 PM

    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."

  • 6.  RE: Prevent closing WO with open PR?

    Posted Fri July 23, 2021 12:40 PM
    Edited by System Wed March 22, 2023 11:49 AM
    A colleague sent me a related script that could possibly be adapted for this purpose. I'll post it here just for future reference:

    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")
    actMatSet=mbo.getMboSet("$MAT","MATUSETRANS","refwo='"+wonum+"' ")
    actLabSet=mbo.getMboSet("$LAB","LABTRANS","refwo='"+wonum+"' ")
    actSrvSet=mbo.getMboSet("$SRV","SERVRECTRANS","refwo='"+wonum+"' ")
    if (worktype=='CM' and status=='CLOSE' and actMatSet.isEmpty() and actLabSet.isEmpty() and actSrvSet.isEmpty() and actToolSet.isEmpty()) :

  • 7.  RE: Prevent closing WO with open PR?

    Posted Fri July 23, 2021 12:47 PM

    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