Maximo

 View Only
  • 1.  Apply a Asset Template to an Asset with the use of Maximo Automation Script

    Posted Wed March 27, 2024 05:56 AM

    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).

    Bportaluri remove preview
    Maximo 7.6 API - Uses of Interface psdi.plusc.app.plusctmplt.PlusCAssetTemplateRemote
    View this on Bportaluri >



    ------------------------------
    Vincent Wanders
    ------------------------------


  • 2.  RE: Apply a Asset Template to an Asset with the use of Maximo Automation Script

    Posted Tue May 21, 2024 09:44 AM

    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
    ------------------------------



  • 3.  RE: Apply a Asset Template to an Asset with the use of Maximo Automation Script

    Posted Tue May 21, 2024 01:48 PM

    Hi Vincent,

    Looking over the javadocs I can see you'll need to initialise a set for the non persistent table PLUSCPREGENASSET, which would then allow you to call the applyTemplateOnExistingAssets method. Something along the lines of the below may work 👍

    preGenAssets=server.getMboSet('PLUSCPREGENASSET')

    ### Add mbo, and populate with your asset details
    asset=preGenAssets.add()
    asset.setValue('ASSETNUM' etc etc
    ###

    ### Call apply template method on the preGen set
    preGenAssets.applyTemplateOnExistingAssets([asset template mbo here])



    ------------------------------
    Joshua Conneely
    ------------------------------



  • 4.  RE: Apply a Asset Template to an Asset with the use of Maximo Automation Script

    Posted Wed May 22, 2024 11:32 AM

    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
    ------------------------------



  • 5.  RE: Apply a Asset Template to an Asset with the use of Maximo Automation Script

    Posted Fri May 24, 2024 06:49 AM

    Thnx. This is working like a charm!



    ------------------------------
    Vincent Wanders
    ------------------------------



  • 6.  RE: Apply a Asset Template to an Asset with the use of Maximo Automation Script

    Posted Mon August 26, 2024 06:55 PM
    Hi, I have the same problem, I just need to add the description and assettype fields to the asset that is being created. Could you share the code as an example since I have not been able to implement them?
     
    I would really appreciate it.


    ------------------------------
    Adolfo Angel Garcia Martinez
    ------------------------------