Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Labor Reporting(Mobile) issue in Mas9.1

    Posted 04/06/26 09:40 AM

    Hi all,

    I am working on customization for application labor reporting(Mobile). the requirement is,

    1. while approving labor transaction we have to check its projectid and taskid and throw an error if it's projectid and taskid is having specific value

    after a long working session, finally it is working to replace the default tool bar action "APPRLABOR".

    i created an action script and executing that action script through signature option.,

    the script is

    ############################################################################################################################
    # Script Name       : APPRLABOR1
    # Launch Point      : (Action)
    # Launch point type : Action Launch Point
    # Description       : Controls LABTRANS approval only on LABREPMOB(Labor Reporting (Mobile EL)) application

    #################################################################################################################################################################
    # Developer                    Version          Date                   Remarks                              
    #----------------------------------------------------------------------------------------------------------------------------------------------------------------
    # Karthik Krishnamurthy        0.1            19-Mar-2026              
    #
    #################################################################################################################################################################


    from psdi.mbo import MboConstants
    from psdi.mbo import MboSetRemote
    from psdi.mbo import Mbo
    from psdi.server import MXServer
    from psdi.webclient.system.beans import ResultsBean
    from psdi.util.logging import MXLoggerFactory
    from psdi.common.context import UIContext
    from psdi.webclient.system.session import WebClientSessionManager
    from psdi.webclient.system.controller import SessionContext, Utility, WebClientEvent
    from java.lang.System import out

    app=service.webclientsession().getCurrentApp().getAppBean().getSelection()
    appName = service.webclientsession().getCurrentAppId()
    appName = str(appName)
    if interactive:
        if app.size()==0:
            service.error("LABTRANS", "NORECORDS")
        else:
            for i in range(0,app.size()):
                flag1=0
                flag2=0
                record= app.get(i)
                if(record.getString("SITEID")=="ELEC"):
                            if(record.getString("TRANSTYPE") in ['OUTAGE','DRIVEIA','RETURNIA']):
                                if(record.getString("FINCNTRLID")=="5540959"):
                                    flag1=1
                                if(record.getString("VEHUNITID1")is None or record.getString("VEHUNITID1").strip()=="") and (record.getString("VEHUNITID2") is None or record.getString("VEHUNITID2")=='') and (record.getString("VEHUNITID3") is None or record.getString("VEHUNITID3")=="") and (record.getString("VEHUNITID4") is None or record.getString("VEHUNITID4")=="") and (record.getString("VEHUNITID5") is None or record.getString("VEHUNITID5")==""):
                                    flag2=1            
                                if(flag1==0 and flag2==0):
                                    record.approveLaborTransaction()                      
                                    record.setValue("FLAPPROVEDATE", MXServer.getMXServer().getDate(), MboConstants.NOACCESSCHECK)                                                   
                                if(flag1==1):
                                    service.error("LABTRANS","FINCNTRLID")
                                elif(flag2==1):
                                    service.error("LABTRANS","VEHICLES")
                            else:
                                record.approveLaborTransaction()                      
                                record.setValue("FLAPPROVEDATE", MXServer.getMXServer().getDate(), MboConstants.NOACCESSCHECK) 
                else:
                    record.approveLaborTransaction()                      
                    record.setValue("FLAPPROVEDATE", MXServer.getMXServer().getDate(), MboConstants.NOACCESSCHECK) 

        service.webclientsession().getCurrentApp().getAppBean().save()
        service.webclientsession().getCurrentApp().getAppBean().reset()

    =================================================================

    this is working if there is file in the list page, but it doesn't throws any error if there is no record in the list. i am thinking i missed some code part to check the bean is empty or not.

    i want to through out of box error "There is no records to approve" if there is no record in the list. please chck my code and correct where i need modifications



    ------------------------------
    Regards
    ---------------------------
    Karthik Krishnamurthy
    ---------------------------
    ------------------------------


  • 2.  RE: Labor Reporting(Mobile) issue in Mas9.1

    Posted 04/07/26 08:29 AM

    Action launch point automation scripts use a signature option to trigger the event. Signature options need to evaluate in context of a record (because it can be conditional) and you have no record. IBM has a technote on this limitation, though it doesn't explain why Automation Scripts to fire from the List tab.

    In MAS, there is the concept of bean class automation scripts that would allow you to handle the event even when no records are on the list tab. I talk about it in one of the comments here: MSUG - Automation Scripts in Maximo Application Suite | Maximo Open Forum



    ------------------------------
    Steven Shull
    Principal Maximo Solutions Engineer
    Naviam
    Cincinnati OH
    ------------------------------



  • 3.  RE: Labor Reporting(Mobile) issue in Mas9.1

    Posted 04/08/26 11:13 AM

    Thank you steven for this valuable information. will try that Bean Level customization

    Regards,

    Karthik Krishnamurthy



    ------------------------------
    Regards
    ---------------------------
    Karthik Krishnamurthy
    ---------------------------
    ------------------------------