Showing posts with label child table. Show all posts
Showing posts with label child table. Show all posts

Saturday, 9 November 2019

Dynamically modifiy the body of Communication Template Jython | IBM Maximo

Recently we have a requirement to modify the content of communication templates based on the record; for instance, put all the lines of a PO into the communication template before sending an email.

Also, this technique can be used to send PO to the vendor by creating a new relationship to get the email id of the vendor from Companies.

1. Create an Object Launch Point automation script with SAVE - ADD - After Save events.
2. put this code as a script. it will call an existing template, modify and send it.

 
if (mbo.getString("STATUS") == "APPR"):
      # whereclause is a string with condition to select a comm.template
      whereclause = "TEMPLATEID ='PO-APPR-MGRR'"

      # Get the Communication template via Asset relationship to send email 
      # mbo is implicit asset object through which we get a template            
      ctMboSet = mbo.getMboSet("$commtemp","COMMTEMPLATE",whereclause);
      ctMboSet.setQbeExactMatch("true")
      ctMboSet.reset()
      ctMbo = ctMboSet.getMbo(0)
     
      corcount = mbo.getMboSet("POLINE").count()
      coractionset = mbo.getMboSet("POLINE")
      txtres = " "
         

Sunday, 1 January 2017

Create a Child Table Using Table Control | IBM Maximo

1. First, drag and drop a table control in Maximo, set properties as below:


Data Source Id:            main_tasks_table
Relationship:               Master_Detail_Relation (master to detail main relationship)

2. Drag a Default value control and set properties as below:
From Data Source ID: MAINRECORD
From Attribute: ParentTableID
Attribute: ChildTableID
--------------


or it can be done with an automation script.

For instance, the table ( prchild ) is a child of the PR table. So just write an automation script and name it as below:

NAME: PRCHILD.NEW

owner=mbo.getOwner()
if owner and owner.isBasedOn("PR"):
    mbo.setValue("PRNUM",owner.getString("PRNUM"))
    mbo.setValue("SITEID",owner.getString("SITEID"))