Outbound Transactions – modifying data on the fly

Last week I had a requirement to transform values on some fields that are part of object structure that is used by Maximo Anywhere . To be precise, requirement was to transform data on DOCLINKS that are part of the object structure OSLCWODETAIL – change description of attached document based on the document type so when attachments are listed  on mobile app for work order, titles of those attachments are a bit different that when viewed in Maximo web app.

I was looking online on some kind of solution so I run into couple of interesting articles that almost had had solution for my requirement:

Outbound processing of object structures

Automation Script for Maximo Integration Framework (MIF) – Enterprise Service

And those explain in details how solution should work, but my problem was that all these examples are working with main object and I was able to do change on work order description for OSLCWODETAIL object structure, something like this:


def overrideValues(ctx):
  if ctx.getMboName()=='WORKORDER':
    ctx.overrideCol("DESCRIPTION","WORK ORDER TO DO SOMETHING")

at first I was not able to figure out how to change DOCNAME on  DOCLINK object that is part of object structure OSLCWODETAIL. I even found somewhere that you can fetch mbo object from this context object like this:


def overrideValues(ctx):
  if ctx.getMboName()=='WORKORDER':
    wombo = ctx.getMbo()
    doclink = wombo.getMboSet("DOCLINKS").getMbo(0)
    doclink.setValue("DOCNAME","WORK ORDER TO DO SOMETHING");

But that did not work … simply calling rest web service would not have any value changed. finally I tried this:


def overrideValues(ctx):
  if ctx.getMboName()=='DOCLINK':
    ctx.overrideCol("DOCNAME","ATTACHMENT FOR WORK ORDER")

Actually I realized that this function overrideValues is called recursively for each related object in object structure so all I had to do was to detect what is the current object name in object structure that is processed and in case of DOCLINK change to whatever I needed.

I hope this example helps any of you in one of your future tasks 🙂

 

Posted in IBM Maximo Tagged with: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Subscribe for Newsletter

Categories