You can create an automation script to customize mapping for an integration point in the
integration between Maximo® Manage and Digital Twin
Exchange. You specify the additional Manage 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 Manage. You can customize this mapping to also map the
Digital Twin Exchange product identifier to the SERIALNUM attribute in the ASSET
object.
Procedure
- In the Automation Scripts application, select the
Create>Script for Integration action.
- Select Object Structure as the integration component.
- In the Object Structure field, select
MXAPIASSETSPARE.
- Select Inbound Processing as the processing point.
- In the Script Language field, select
python.
- 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)
- Click Create.