Customizing integration mapping

You can create an automation script to customize mapping for an integration point in the integration between Maximo® Asset Management and Digital Twin Exchange. You specify the additional Maximo fields that you want to populate with incoming Digital Twin Exchange data during an import.

About this task

The default integration mapping for assets maps the incoming Digital Twin Exchange product identifier to the ASSETNUM attribute in the ASSET object in Maximo Asset Management. You can customize this mapping to also map the Digital Twin Exchange product identifier to the SERIALNUM attribute in the ASSET object.

Procedure

  1. In the Automation Scripts application, select the Create>Script for Integration action.
  2. Select Object Structure as the integration component.
  3. In the Object Structure field, select MXAPIASSETSPARE.
  4. Select Inbound Processing as the processing point.
  5. In the Script Language field, select python.
  6. In the bottom section, paste the following script:
    from psdi.mbo import MboConstants
    from com.ibm.tivoli.maximo.digitaldata import digitaltwin
    from psdi.server import AppService, MXServer
    
    def afterMboData(ctx):
        ctx.log("afterMboData")
        if ctx.getMbo() is not None:
            dtServer =  MXServer.getMXServer().lookup("DIGITALTWIN")
            if ctx.getMbo().isBasedOn("ASSET"):
                # get product id
                assetnum = ctx.getMbo().getString("assetnum")
                indx = assetnum.rindex("-")
                id= assetnum[0:indx]
    
                # get products api response body
                productPayload = dtServer.getProducts(id)      
               
                # get productid from response
                productId = str(productPayload.get("id")) 
    
                 #set maximo serialnum to product id      
                ctx.getMbo().setValue("serialnum", productId)
  7. Click Create.