Pages

Wednesday, January 6, 2021

How to generate asset description from classification using automation script

To generate the description from classification, Generate Description (GENASSETDESC) and Use Classification (USECLASSINDESC) has to be checked. Maximo will set the description of the asset generated from classification if any value in the classification/asset specification is updated in the UI. If we add a new attribute to classification the description may not be updated manually. To programmatically set the description we can use automation script action launch point and run it as escalation. 

 Below is the code for that.

Language: Python   

from psdi.server import MXServer
from psdi.mbo import MboConstants

assetSpecSet = mbo.getMboSet("ASSETSPEC")
assetSpec = assetSpecSet.moveFirst()
classstructure = assetSpec.getMboSet("CLASSSTRUCTURE").moveFirst()
assetcat = MXServer.getMXServer().lookup("ASSETCATALOG")
description = assetcat.generateDescription(classstructure, assetSpecSet)
mbo.setValue("DESCRIPTION", description, MboConstants.NOACCESSCHECK)
mbo.getThisMboSet().save()

Create an automation script with Action Launch Point with above mentioned code and run as escalation for the assets that need to update the asset description.

No comments:

Post a Comment