Technical Blog Post
Adding a toolbar button in an Application for an Automation Script.
This will show you how to add a toolbar button for an Automation script. I have included a “dummy” script that does not do much,
it is just to show you how to add a toolbar button to an application.
Create the script.
Notice that I picked ASSET for my object, I plan to add this button to the Asset Application. I then select a name for my actual script,
Add your code to the next dialog box and create the Launch Point. If you do not have a code to test with, here is a piece of code that print some
Work Orders in the log,
from psdi.server import MXServer from java.text import SimpleDateFormat sdf = SimpleDateFormat fmt_out = sdf('yyyy-MM-dd HH:mm') whereClause = "wonum in ('1000', '1001', '1002')" mboMainSet = MXServer.getMXServer().getMboSet("workorder", MXServer.getMXServer().getSystemUserInfo()) mboMainSet.setWhere(whereClause) mboMainSet.reset() mainCount = 0 print "Running Automation Script." while mboMainSet.getMbo(mainCount) is not None: myMbo = mboMainSet.getMbo(mainCount) mainCount = mainCount + 1 print "Work Order: " + myMbo.getString("wonum") + " " + myMbo.getString("description") print "Status: " + myMbo.getString("status") + " " + fmt_out.format(myMbo.getDate("statusdate"))
This script shows you how to get a Mbo set from any object in Maximo and also how to format a date in case you want a specific date format.
Add toolbar button to application
Go to Application Designer and bring up the Asset Application, bring up the Add/Modify Signature Options dialog box from the Select Action menu.
In this case, Tabs were chosen to be MAIN, if you want to be able to run the report from any tab, set it to ALL.
Enable toolbar button in Security Groups
Go to Security Groups and find your group that will be using this toolbar button, I used MAXADMIN in my demo database.
Enable logging for the script
Clicking the Run My Script button does not do much since we set the Log level to DEBUG. If you want to see the output in the log,
Set the Log Level to DEBUG, save and Apply Settings, the next time you run the script you should see something like this in the log,
31 Mar 2014 13:35:49:220 [DEBUG] [MXServer] [CID-MXSCRIPT-604] Running Automation Script. Work Order: 1000 Relocate Guard Rails Around Compressor Status: WAPPR 1999-02-06 14:25 Work Order: 1001 12 Month Service on Shipping Dept #1 Conveyor Status: INPRG 1999-01-01 09:46 Work Order: 1002 Rebuild Feedwater Pump Status: APPR 2003-02-27 10:48