Thursday, 6 February 2020

RUN A SCRIPT INTERACTIVELY FROM ICD/MAXIMO




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.
AttentionIf 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:
Selection_042
The result should look as follows:
Selection_043

  • list only active users ..you can add this
    # Example: Loop over all Users….
    userSet = mxServer.getMboSet(‘MAXUSER’, userInfo)
    #— list only active users add SQL where ————–
    userSet.setWhere (“STATUS = ‘ACTIVE'”)
    # – Run SQL filter
    userSet.reset()

No comments:

Post a Comment

IBM Readme for IBM Maximo Asset Management 7.6.1.3 Fix Pack

  Fix Readme Abstract This fix pack updates IBM® Maximo® Asset Management version 7.6.1, 7.6.1.1, and 7.6.1.2 Content IBM Maximo Asset Manag...