Automation script to create Release from Project

About this task

An automation script is configured to create Release from Project. The script is designed to pull project-related data from the current MBO, access the object, and create and save the new release record in Maximo IT. It also ensures consistent naming, linking, and reuse of financial and project details.

Follow the steps below to create the automation script:

Procedure

  1. Open the Automation Scripts application.
  2. On the navigation panel, click Create and select Script with Action Launch Point : Step 1 of 3, and enter data in the fields as follows:
    • Launch Point: Specify the launch point name, for example, CREATERELEASE.
    • Object: Search for the PROJECT object and select it.
    • Action: Specify the Action name same as the name given for Launch Point, for example, CREATERELEASE.
    • Check the checkbox for Active? and click Next.
  3. On the Create Script with Action Launch Point : Step 2 of 3 pop-up, enter the details in the fields as follows:
    • Script: Specify as Jython
    • Script Language: Search and select jython
    • Log level: Search and select ERROR
    • Click Next.
  4. On the Create Script with Action Launch Point : Step 3 of 3. In the Script box, enter the following script and click Create.
    Note: The below script is a sample and for reference only, update the script as per your custom field ID's and other changes as necessary.
    #Script Name: CREATERELEASE
    #DESCRIPTION: Create Release From Project
    #Script Language: jython
    #Log Level: ERROR
    #Launch Point: CREATERELEASE
    #Launch Point Type: ACTION
    #Action Value: com.ibm.tivoli.maximo.script.ScriptAction
    #Action Type: Custom Class
    #Parameters: CREATERELEASE,CREATERELEASE,CREATERELEASE
    
    from psdi.mbo import Mbo 
    from psdi.mbo import MboSet 
    from psdi.mbo import MboConstants
    from psdi.mbo import MboRemote 
    from psdi.server import MXServer
     
    projectid = mbo.getString("PROJECTID")
    project_desc = mbo.getString("DESCRIPTION")
    fincntrlid = mbo.getString("FINCNTRLID")
    
    server = MXServer.getMXServer() 
    session = service.webclientsession();
    #releaseSet = mbo.getMboSet("PROJECTRELEASE")
    #session.showMessageBox(session.getCurrentEvent(), "CUSTOM", "MESSAGE",["Releases linked with this project "+str(releaseSet.count())]);
    #user = scriptHome.getUserInfo() 
    userInfo = MXServer.getMXServer().getUserInfo("MAXADMIN") 
    releaseSet = server.getMboSet("WORELEASE",  userInfo)
    releaseMbo = releaseSet.add() 
    desc = "New Release for Project - ["+projectid +"]["+project_desc+"]"
    releaseMbo.setValue("DESCRIPTION", desc) 
    releaseMbo.setValue("fincntrlid",fincntrlid)
    releaseMbo.setValue("FCPROJECTID",projectid)
    releaseNum=releaseMbo.getString("WONUM")
    releaseSet.save() 
    session.showMessageBox(session.getCurrentEvent(), "CUSTOM", "MESSAGE",["Release created with wonum = "+releaseNum]);
  5. Save your changes.