Maximo Open Forum

 View Only

 Automation script (How would you identify if your running the script from the list tab or main record ?

Jump to  Best Answer
  • Administration
  • Customizations
  • Everything Maximo
Ryan Medernach's profile image
Ryan Medernach posted 05-10-2024 13:48

I'm looking to write an automation script on a custom app/object that will calculate due days that will run from the following locations

  • Escalation - Nightly
  • List tab - on a list of records - Using an action 
  • Main Record- Using an action

In the script is there something that can identify if the user is on the "List View" or "Main" tab ?

Just playing around this appears to return "mainrec" it doesn't matter what tab I'm on so I think I'm way off on that

sessionRMLIST=service.webclientsession()
log.debug ("#####SessionRMLIST DEBUG find if we are on a list tab ?")
log.debug ("##  "+ str(sessionRMLIST.getCurrentPage()))
log.debug ("##  "+ str(sessionRMLIST.getCurrentPageId()))

10 May 2024 11:46:17:947 [DEBUG] #####SessionRMLIST DEBUG find if we are on a list tab ?
10 May 2024 11:46:17:947 [DEBUG] ##  PageInstance [id: mainrec]
10 May 2024 11:46:17:947 [DEBUG] ##  mainrec

I'm just playing around and I'm thinking I might be able to do this using the service.webclientsession() somehow or maybe someone has a better way ?

I

Steven Shull's profile image
Steven Shull  Best Answer

You can determine if you're on the list tab with something like this:

if interactive:
    session=service.webclientsession()
    onListTab=session.getCurrentApp().onListTab()

Then assuming you are selecting records (IE using the checkbox) you would want to get the selection by using something like:
resultBean=session.getCurrentApp().getResultsBean()
let selectedRecords=resultBean.getSelection()
iterator=selectedRecords.iterator()
while iterator.hasNext():
    assetMbo=iterator.next()
    # Your logic here to act on the Mbo