The Automation Script application provides the capability to directly run a script without having a launch point defined. This is useful to test some scripting capabilities or to run scripts performing maintenance tasks triggered by an user.
Attention: If you are using Maximo or ICD in Version 7.6.x you might not find the “Launch Script” Action. In that case you should read this article to solve this issue first!
To test this behavior we will create a simple script without a launch point which lists all defined users from the ICD/Maximo system. Important is, that in this scenario no implicit variables are available and you have to initialize your MBO context manually based on the MXServer object. The scripts looks as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| #DESCRIPTION:Script to demonstrate usage of Run-Script function from GUI from psdi.server import MXServer from psdi.iface.mic import MicService mxServer = MXServer.getMXServer() micService = MicService(mxServer) micService.init() userInfo = micService.getNewUserInfo() # Example: Loop over all Users.... userSet = mxServer.getMboSet( 'MAXUSER' , userInfo) userMbo = userSet.moveFirst() while (userMbo ! = None ): print "User " ,userMbo.getString( "USERID" ) userMbo = userSet.moveNext() |
To run the script you should hit the following icon in the Taskbar of the Automation Script application:
The result should look as follows:
userSet = mxServer.getMboSet(‘MAXUSER’, userInfo)
#— list only active users add SQL where ————–
userSet.setWhere (“STATUS = ‘ACTIVE'”)
# – Run SQL filter
userSet.reset()