About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Technical Blog Post
Abstract
A Simple Automation Script
Body
There are times when you may wish to set a default value for a new attribute on an application, but using a default control or a
crossover domain does not work to set this default value. If you wish to automatically copy a value from one attribute to another
as you are entering the record, then sometimes the best way to do this is with an Automation Script. An Automation Script may
sound daunting but you can create a simple script with only a single line of code that will copy the value from one attribute to another.
Once you are done submitting your script it gets executed immediately and there is no need to restart your server or rebuild/redeploy
the maximo.ear file.
In the following example in the Person application, we have added a user defined attribute called CURRENTPHONE, and we wish to
automatically copy the value from PRIMARYPHONE to CURRENTPHONE when the new Person record is being entered. We will use
an Attribute Launch Point script that can be used to customize field validations and actions.
1) Go To – System Configuration – Platform Configuration – Automation Scripting – click on Select Action – Create –
Scripting with Attribute Launch Point:
2) Then enter the following values:
Launch Point: PHONE
Description: Setting CURRENTPHONE from PRIMARYPHONE
Active: CHECKED
Object: PERSON
Attribute: PRIMARYPHONE
Click on the 'Next' button.
3) Within the 'Create Script with Attribute Launch Point : Step 2 of 3' add the following:
Script: PHONE
Description: Setting Current Phone from Primary Phone
Script Language: jython
4) Within the Variables pane, click on New Row. Add the following:
Variable: PRIMARYPHONE
Variable Type: INOUT
Override? CHECKED
Binding Type: ATTRIBUTE
Launch Point Attribute: PRIMARYPHONE
5) Within the Variables pane, click on New Row. Add the following:
Variable: CURRENTPHONE
Variable Type: INOUT
Override? CHECKED
Binding Type: ATTRIBUTE
Launch Point Attribute: CURRENTPHONE
We don't actually need to explicitly define the PRIMARYPHONE variable since it is already available implicitly inside the script
as the attribute on which the script is listening as defined in step 2. However sometimes it makes scripts easier to follow if all
variables are explicitly defined.
6) Click on Next button. Within the 'Create Script with Attribute Launch Point : Step 3 of 3' add the following script:
CURRENTPHONE = PRIMARYPHONE
Click on the Create button and your script should be completed. Please note that the Status value on the main (Automation Script)
tab will be set to Draft but this does not currently have any functionality on the script. The script will still run with this status value set
to Draft. Within the Launch Points tab – the Active? checkbox controls the logic if the Launch Point is executed, and is set to checked
(active) by default. To disable the Launch Point, uncheck the Active? checkbox and click on Save.
7) You can test your script by either adding or modifying an existing Primary Phone value in the Person (People) application.
Create a new person record and enter a Primary Phone value.
Once you tab out of the Primary Phone attribute or save the record, the phone number value will be copied automatically from the
Primary Phone attribute to the Current Phone attribute.
This is a simple example of a script but shows how you can create a script using only a few lines of code and that you don't need to be
an experienced script writer to do this.
[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]
UID
ibm11132737