Hello All,
We too are having the same issue and am wondering if there is a way out.
The automatically approve labor transaction on the Organization option is set to false.
Now we want to CLOSE the work order. If there are unapproved labor transactions, Maximo will not allow the WO to be closed.
So we have 2 actions. First is an automation script to approve the labor and the second is an action to change status to CLOSE. The same thing is happening for us. The labor transaction is getting approved, there is a status history record in the WOSTATUS table, but the work order does not update the status field to CLOSE.
In the automation script, we are calling the Labtrans save method after setting the GENAPPRSERVRECEIPT flag to1. The log shows that the work order is saved at this point in time (but the status field is not modified as we have still not invoked the second action to change status to CLOSE), the WOSTATUS is added with the CLOSE status and the LABTRANS is updated with the approval flag.
When the second action to change the WO status is invoked, nothing is happening. Could it because the work order was already saved as per above?
How can this be overcome? Any suggestions would be appreciated.
Regards,
Priyaranjandas
------------------------------
Priyaranjandas Kolambkar
Kuwait Oil Company
------------------------------
Original Message:
Sent: 06-23-2022 11:33
From: Steven Shull
Subject: Automation Script Change Status
How is this action being called? I've tested escalation & a UI push button with similar code to yours and it works in my 7.6.1.2 environment.
My guess is that there is another save occurring before this code fires. If that's the case saving the set a second time won't work and would explain why the WORKORDER record itself isn't updating. As an example, I added a save at the beginning of my script and left the one at the end after the status change. I made a change to the record (updated the description) and called my action. In that scenario the description is saved, the status history is recorded, but the work order is not updated.
I wouldn't personally use the 9L (suppressing action & validation) but I tested the script with it and it also worked in my environment. The reason I don't like suppressing action and validation is it either does nothing (which makes it pointless to have) or it does something bad (suppresses validation) that you really don't want to occur on a status change. I tested a few scenarios (going back from COMP->INPRG, having a condition on the status that would make it not valid, etc.) and the errors are still thrown so I'm assuming this is mostly at least a case of it not doing anything.
------------------------------
Steven Shull
IBM
Original Message:
Sent: 06-22-2022 22:40
From: Alief Harry
Subject: Automation Script Change Status
Hi Steven,
My launch point for automation script is ACTION and this object is WORKORDER, yes I use MboConstants for changeStatus.
I will show my script, here is my script :
Thank you.
------------------------------
Alief Harry
PT Indonesia Comnets Plus
Original Message:
Sent: 06-22-2022 10:52
From: Steven Shull
Subject: Automation Script Change Status
What was your launch point for the automation script to change the status? And were you providing any of the MboConstants to suppress logic?
Some launch points, such as actions, don't explicitly save. And the changeStatus action doesn't call a save. The dialog triggers a save before and after and in the processes where we make status changes in the background we're explicitly calling a save. I wouldn't have expected the status entry to be committed but I'd have to look at the code to see how that's handled.
------------------------------
Steven Shull
IBM
Original Message:
Sent: 06-22-2022 00:01
From: Alief Harry
Subject: Automation Script Change Status
Hi Guys,
Have you ever experienced when you want to change the workorder status using a script but it doesn't work?
I changed the status of the workorder using the changeStatus function in the script, but the only thing that changed was the status in wostatus and the status in the workorder did not change. I need to change the state on the workorder object, please help me
#Customizations
------------------------------
Alief Harry
PT Indonesia Comnets Plus
------------------------------