title: Maximo automatisation script to change statut of workorder
body: <p>I have created a non-persistent attribute in my WoActivity table named VDS_COMPLETE. it is a bool that get changed by a checkbox in one of my application. </p>
  
  <p>I am trying to make a automatisation script in Python to change the status of every task a work order that have been check when I save the WorkOrder. </p>
  
  <p>I don't know why it isn't working but I'm pretty sure I'm close to the answer...
  Do you have an idea why it isn't working? I know that I have code in comments, I have done a few experimentations...</p>
  
  <pre><code>from psdi.mbo import MboConstants
  from psdi.server import MXServer
  
  mxServer = MXServer.getMXServer()
  userInfo = mxServer.getUserInfo(user)
  
  mboSet = mxServer.getMboSet("WORKORDER")
  #where1 = "wonum = :wonum"
  #mboSet .setWhere(where1)
  
  #mboSet.reset()
  
  workorderSet = mboSet.getMbo(0).getMboSet("WOACTIVITY", "STATUS NOT IN ('FERME' , 'ANNULE' , 'COMPLETE' , 'ATTDOC')")
  #where2 = "STATUS NOT IN ('FERME' , 'ANNULE' , 'COMPLETE' , 'ATTDOC')"
  #workorderSet.setWhere(where2)
  
  
  if workorderSet.count() &gt; 0:
      for x in range(0,workorderSet.count()):
          if workorderSet.getString("VDS_COMPLETE") == 1:
              workorder = workorderSet.getMbo(x)
              workorder.changeStatus("COMPLETE",MXServer.getMXServer().getDate(), u"Script d'automatisation", MboConstants.NOACCESSCHECK)
  
  workorderSet.save()
  workorderSet.close()
  </code></pre>