Hi Vincent.
You can use following code which will apply asset template to assets:
from psdi.server import MXServer
#considering current mbo is Asset
#Fetch assettemp mbo first
AssetTemplateMbo = mbo.getMboSet("$ASSETTEMPLATESET","PLUSCTEMPLATE","TEMPLATEID='"+(provide_tempid_here)+"'").getMbo(0)
#if need to apply for multiple assets, use a loop here
v_assetnum = mbo.getString("ASSETNUM")
v_siteid = mbo.getString("SITEID")
currentDate = MXServer.getMXServer().getDate()
pluscdassetdataSet = mbo.getMboSet("$PLUSCDASSETDATASET","PLUSCDASSETDATA","1=0")
pluscdassetdataMbo = pluscdassetdataSet.add()
pluscdassetdataMbo.setValue("SITEID",v_siteid,11L)
pluscdassetdataMbo.setValue("PMSTARTDATE",currentDate,11L)
pluscpregenassetSet = pluscdassetdataMbo.getMboSet("PLUSCPREGENASSET")
if pluscpregenassetSet.isEmpty():
pluscpregenassetMbo = pluscpregenassetSet.add()
pluscpregenassetMbo.setValue("EXISTINGASSETNUM",v_assetnum,pluscpregenassetMbo.NOVALIDATION|pluscpregenassetMbo.NOACCESSCHECK)
pluscpregenassetMbo.setValue("SITEID",v_siteid,pluscpregenassetMbo.NOVALIDATION|pluscpregenassetMbo.NOACCESSCHECK)
pluscpregenassetMbo.setValue("PMSTARTDATE",currentDate,pluscpregenassetMbo.NOVALIDATION|pluscpregenassetMbo.NOACCESSCHECK)
#call apply template to existing assets method on the pluscpregenset
pluscpregenassetSet.applyTemplateOnExistingAssets(AssetTemplateMbo)
----------------------------------
Puraanam Venkat
---------------------------------
------------------------------
Puraanam Venkata Sai Surya Kartik Sastry
------------------------------
Original Message:
Sent: Tue May 21, 2024 09:44 AM
From: Vincent Wanders
Subject: Apply a Asset Template to an Asset with the use of Maximo Automation Script
Is there anyone who can answer this question because this is still an issue for me.
Any help would be very appreciated!
Regards,
Vincent Wanders
------------------------------
Vincent Wanders
Original Message:
Sent: Wed March 27, 2024 05:55 AM
From: Vincent Wanders
Subject: Apply a Asset Template to an Asset with the use of Maximo Automation Script
Is there a function within automation script to apply an Asset Template to an Asset?
Something maybe using an existing class/function as "applyTemplateOnExistingAssets"
This one I found on:
Maximo 7.6 API - Uses of Interface psdi.plusc.app.plusctmplt.PlusCAssetTemplateRemote
The idea is to have something like:
TargetAsset.applyTemplateOnExistingAssets(TemplateID)
The "old fashion" idea is to update Asset with PLUSCTEMPLATE fields, create Spareparts, Meters and PM schedules.
I can do that but I prefer to use a function like "applyTemplateOnExistingAssets" (if it exists).
------------------------------
Vincent Wanders
------------------------------