In IBM Maximo, it’s possible to add a direct print option to a report. This adds a printer icon to the toolbar and allows you to run the report with just one click. But where the report requires parameters before running, this option is not available…
Usually, a user will have to click the “Run Reports” action, then find their report in the list of all reports available for that application. They then click on the one they want before being taken to the IBM Maximo Reports Request page.
In this blog, I’ll show you how to get around that problem. In our example, we use an Action launch point for an Automation Script and link it to a menu item in IBM Maximo Application Designer.
(It’s worth noting at this point that the script uses some functionality that’s only available in 7.6.1 and above; if you’re on an older version and would still like to achieve this, get in touch and we can talk through the best way to do so.)
In the video above I show you how we can make a new action to automatically load up the Request page for a report. This can be achieved by creating a new script with an action launch point in IBM Maximo Automation Scripts.
We need to give the launch point a name, which will be the same name used in the Signature option in Application Designer. This is limited to 25 characters on a standard Out-Of-The-Box Maximo, so we’ll just keep it short for now, and call both the launchpoint and action ‘AMREP’. In the description fields, we will add ‘Asset Movement Report’.
We can give the script the same name too. For this example, we won’t add in any variables. However, if you wanted to use this to call multiple reports or multiple applications, there would be no issue with adding a variable to include the name of the report.
This can be left as PYTHON or JYTHON. We then bring in the code (see below)…
This will bring back the REPORTNUM for the report ‘assetmove_history.rptdesign’ on the Asset application.
You could just hard code this number. Alternatively, you can also pass it in as a launch point variable if you are able to query the database for it yourself. The script then calls the dialogue for that report using the reportnum.
This should then have created both a launch point and an action. With these in place, we can go to Application Designer, and to the Asset application. The we can add a new signature option – ‘AMREP’. Once entered, we then open up the Advanced Signature options and choose the option ‘This is an action that must be invoked by the UI’. The system then knows that this option name matches an action. This, in turn, is going to call our launch point for the script.
Once we have done this, the action should now be added. However, we may also want to add it to our actions menu on the left-hand side of the app… Click Add New – the element type is ‘Option’, and the key-value should show up as AMREP. We then give this a position (try and find one that isn’t currently in use).
We can choose which tabs this will show up on.
There is a request page that allows you to enter the parameters for the asset number. In this case, we’ll allow ALL tabs, but in some cases, you may only want this to appear in your main tabs.
Everything should now be in place; we just need to grant permissions into Security Groups – click on the Asset application, then Asset movement Report, Grant permission…
We then just need to sign out, and back in for that to take effect!
When we log back into the Assets application, we should now see an option for the Asset Movement Report. This will bring up the Report Request page for that report, rather than going to Run Reports and Asset Move history.
Here’s the code – ‘Calling a Report directly from the Action Menu in IBM Maximo‘
###################################################################
# AUTHOR P IRVING #
# DATE 05/11/2020 #
# BPD ZENITH Ltd #
# https://www.bpdzenith.com/ #
###################################################################
from psdi.mbo import SqlFormat;
from psdi.webclient.system.session import WebClientSession;
wcs = service.webclientsession()
#If there's two we'll get the first in the sequence
sqf = SqlFormat(mbo, "APPNAME=:1 AND REPORTNAME=:2")
sqf.setObject(1, "REPORT", "APPNAME", app)
sqf.setObject(2, "REPORT", "REPORTNAME", "assetmove_history.rptdesign")
where = sqf.format()
reportSet = mbo.getMboSet("$REPORTSPI","REPORT",where)
#Set the set as disposable, we're not changing the report just reading it
reportSet.setFlag(39L,True)
reportSet.reset()
report = reportSet.moveFirst()
reportnum = str(report.getInt("REPORTNUM"))
pageName = "reportd"+reportnum
wcs.loadDialog(pageName)
reportSet.close()
Things to remember – IBM Maximo Launch Points, Security Groups and Application Designer:
Keep your launch point name under 25 characters. The script launch point name and action can be up to 30 characters, the signature option can only be 25. They must match, so we need to make this under 25 characters.
- If your option doesn’t show up in the list but you’ve granted it to a security group, you need to make sure everyone in that group has logged out at the same time for the changes to take effect.
- If you want it in the common actions menu or on the toolbar you can do this in the application designer by choosing Add/Modify Toolbar Menu. Then add a new row for your option.
You could extend this script further and make it more versatile. Do this by adding a script variable called report with a binding type of LITERAL. You can then override the value for each new launchpoint you have – one for each report you want to run. Change line 9 of the script to look at the variable instead of the string I hardcoded in the video:
sqf.setObject(2, "REPORT", "REPORTNAME", report)
BPD Zenith regularly offers technical tips and support through MaxTECH – a global Maximo user support community built and ran by BPD Zenith. The group has continued to grow over recent years, especially with the move away from physical events due to COVID. This has seen the online community grow exponentially with further reach to a wider variety of Maximo users and experiences.
If you’d like to know more about this or anything else regarding IBM Maximo we’d love to hear from you! You can get in touch using any of the contact links below. You can also subscribe to the latest news, blogs, videos and events at the bottom of this blog.