Goal:
To Create an
automation script in Maximo 7.5.0.4 that is triggered by clicking on an button
in an application.
Example:
A button on the Work
Order Tracking application that triggers a script. The script will read the
Target Start Date from the Work Order, add the Duration to it and will
automatically fill in the Target Finish Date.
How to:
Open the Automation Scripts application. Create a new ‘Script with Action Launch Point’
Fill in the name of the Launch Point, the Object and
the Name of the Action.
We will see this Actionname later when we configure the
button and an Action with this name will automatically be created. We choose to
use a New script. Click [Next] to continue
Next give the New Script a name and description. I use
jython as the script language. We will add variabeles later on, so leave them
for now and click [Next] to continue.
We need to fill in the script here. As we cannot test it
here we will fill in a ‘1’ (cannot leave it blank for some reason) We will
return later to add the correct script. Click the [Create] button
Open the script and go to the ‘Variables’ tab.
Add the following variables by pressing the [New Row] button
Variable: TARGSTART_IN
Description: Target Start Date
Variable Type: IN
Override: Checked
Binding Type: Attribute
Description: Target Start Date
Variable Type: IN
Override: Checked
Binding Type: Attribute
Variable: ESTDUR_IN
Description: Estimated Duration
Variable Type: IN
Override: Checked
Binding Type: Attribute
Description: Estimated Duration
Variable Type: IN
Override: Checked
Binding Type: Attribute
Variable: TARGFINISH_OUT
Description: Target Finish Date
Variable Type: OUT
Override: Checked
Binding Type: Attribute
Description: Target Finish Date
Variable Type: OUT
Override: Checked
Binding Type: Attribute
Click the ‘Save’ icon at the top of the screen and go to the
‘Launch Points’ tab. Click on the ‘Edit Launch Point Detail’ button.
In this screen we bind the created variables to Attributes.
This can be done per Launch point. So if you create multiple launch points you
can use the same variables but bind them to different Attributes.
Open the Details of the attribute and click on the ‘Select
Attribute Name’ button.
Check the Action application to see the
configuration of the Action that was created.
Do not change anything here, this is configured by creating
the launch point, we will just check it here.
Next we will add the button to the screen. Open the
Application Designer en open the WOTRACK application.
Add a Signature Option to the WOTRACK application by going
to the ‘Select Action’ menu and clicking on ‘Add/Modify Signature Options’
Create a new Signature with the same name as the Action.
Open the ‘Advanced Signature Options’ at the bottom of the
dialog and make sure that
“This is an action that must be invoked by use in the UI” is selected.
Click [OK] and Save the ‘WOTRACK’ application.
Now we add a ‘Pushbutton’ to the Work Order tab. Just
somewhere near the Target Start and Target Finish Date fields.
Open the properties of the Pushbutton. Give the Pushbutton a
label and enter the Signature name as Event.
Save the WOTRACK application.
Now we need to give rights to the authorized groups on the
button. Open the Security Groups application. Open the MAXADMIN group, go to
the ‘Applications’ tab and filter for the ‘Work Order Tracking’ application.
Next filter or search for the Signature option we created
and check the ‘Grant Access?’ option.
Save the group.
Now we need to create the actual script. Go to the
‘Automation Scripting’ application. Open the script we created earlier.
We will replace the current code with the code below;
from java.util import Date
TARGFINISH_OUT = Date(TARGSTART_IN.getTime() + long(ESTDUR_IN *
60 * 60 *1000))
In short the code does the following;
Coverting the TargetStartDate to milliseconds, converting
the estimated Duration to milliseconds and adding them up, converting the total
of milliseconds to a date and storing that in the Target Finish Data.
Click the ‘Save’ button, and to test the script, click the
‘Run’ button.
Result of the ‘Run’ button;
This isn’t telling us much as the variabele is empty, so the
calculation is not working…
To properly test the configuration, we will go to the Workorder Tracking
application, and actually push the button.
Push the button, and the date will be calculated.
That was the end of the automation script with a button in
Maximo. Let me know if you have any remarks.
GNZ.