This Automation Script will close all child Task work orders when the Parent work order is closed.
Based on Relationship, We can get Child Work orders or Tasks as we required.
When we are closing the work order if the child is complete. It will close the child WO or Tasks.
Launch Point: Attribute
Object: Workorder
Attribute: Status
Binding Variable: status
Body:
from psdi.server import MXServer
appName = mbo.getThisMboSet().getParentApp()
if appName == "WOTRACK" and status in ('CLOSE') :
childrenSet = mbo.getMboSet("WOACTIVITYTASK") #Getting Child Tasks using Relationship
OSchild = childrenSet.moveFirst()
while (OSchild):
if OSchild.getString("STATUS") =='COMP':
OSchild.changeStatus("CLOSE", MXServer.getMXServer().getDate(), '');
OSchild = childrenSet.moveNext()
No comments:
Post a Comment