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 .get MXSe rver ().g etMb oSet ("wo rkor der" , MXSe rver .get MXSe rver ().g etSy stem User Info ()) mboM ainS et.s etWh ere( wher eCla use) mboMainSet.reset() mainCount = 0 print "Running Automation Script." while mboM ainS et.g etMb o(ma inCo unt) is not None: myMbo = mboM ainS et.g etMb o(ma inCo unt) mainCount = mainCount + 1 print "Work Order: " + myMb o.ge tStr ing( "won um") + " " + myMb o.ge tStr ing( "des crip tion ") print "Status: " + myMb o.ge tStr ing( "sta tus" ) + " " + fmt_ out. form at(m yMbo .get Date ("st atus date ") )
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.
Click new row. Add your Action, make sure you expand the Advanced section and select the “Action” option.
Bring up the Add/Modify Toolbar Menu dialog box from the Select Action
menu. Click new row. Add your new Signature Security Option,
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.
Save, sign out and sign in again with a user belonging to your group.
The icon will appear as a running man in the toolbar, right next to
create report.
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,
either change the logging level for Autoscript to DEBUG or change the
script log level to INFO. I chose to enable the DEBUG logging,
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,