IBM Support

Creating an Automation Script for Attribute Launch Point in Maximo 7.6

Question & Answer


Question

Which events can you select when creating Attribute Launch Points in Maximo 7.6?

Answer

Below are the five events that you can select when creating an Attribute Launch Point:

  1. the "Initialize Value" event is used to initialize the attribute for new records.
  2. the "Initialize Access Restriction" event is used to set an attribute as required or read-only when first accessing the application.
  3. the "Validation" event is used to validate the attribute. Do no include any business logic here by adding new variables.
  4. the "Run Action" event is the place to do all the business logic associated with an attribute. This is not the place to do any validation.
  5. the "Retrieve List" event is used when there is a domain associated with the attribute.

Below are some requirements and some example Attribute Launch Points to illustrate the use of "Validate" and "Run Action" events:

Requirement 1: Vendor is required when asset type is Production (Run Action event).

Requirement 2: Purchase Price must be between $20 - $20000 (Validate event).

Requirement 3: Replacement cost will always be one-half of the purchase price (Run Action event).

Steps:

1. Go to the "Automation Scripts" application.

From the "More Actions" menu, click "Create" and select the "Script with Attribute Launch Point" action.


2. Populate the Launch Point, Object and Attribute fields.

Select the "Validate" event.






Click on the "Next" button.

3. Enter a name for the Script and change the Script Language to 'jython'.









Enter the following in the "Source Code" field:


from psdi.util import MXApplicationException
if purchaseprice < 20 or purchaseprice > 20000:
errorgroup = 'custom'
errorkey = 'outofrangeprice'


NOTE: errorgroup and errorkey needs to be indented. Below is what the script looks like on the screen:



Click on the "Next" button.

A system message is displayed.







Click the "Close" button.

4. Go to the "Database Configuration" application.
Select the "Messages" action and click the "New Row" button.
Populate the Message Group, Message Key, Message ID Prefix and Value fields like in the screenshot below:







Click on the "OK" button.

5. Go to the "Automation Scripts" application.
From the "More Actions" menu, click "Create" and select the "Script with Attribute Launch Point" action.






6. Populate the Launch Point, Object and Attribute fields and select the "Run Action" event.







Click the "Next" button.

7. Click the "New Row" button to create a new variable.
Enter Variable, Variable Type and Launch Point Attribute fields like in the screenshot below.






Click the "New Row" Button to define another variable.
Enter Variable, Variable Type and Launch Point Attribute fields like in the screenshot below.







Click the "Next" button.


8. Enter the source code as below:


if assettype_internal=="PRODUCTION":
vendor_required=True
else:
vendor_required=False



NOTE:
The _internal is an implicit variable that informs the scripting engine that the asset type field is associated to synonym domain.
The _required is another implicit variable for setting mandatory fields.



The "Source Code" screen should look like the one below:







Click on the "Create" button to create the launch point.
A system message is displayed.






Click the "Close" button.

9. From the "More Actions" menu, click "Create" and select the "Script with Attribute Launch Point" action.

Populate the Launch Point, Object and Attribute fields and select the "Run Action" event.






Click on the "Next" button.

10. Populate the Variable, Variable Type, and Launch Point Attribute.







Click on the "Next" button.

11. Enter a name for the script. Enter the source code as below:


if purchaseprice > 200:
replacecost = purchaseprice/2







Click on the "Create" button.
A system message is displayed.







Click the "Close" button.

All three attribute launch points have been created.



Testing the automation launch points


1. Bring up an existing asset in the Assets application.
2. Enter "Production" as the asset type.







3. Scroll down to check the "Vendor" field.
Since the asset type is "PRODUCTION", the vendor field has become a mandatory field as per the "ASSETTYPE" Attribute Launch Point.
i.e. The "Vendor" field has an asterisk besides it to indicate it is a required field.






4. Enter 1000 in the Purchase Price field and tab out of the field.

Since the Purchase Price is greater than 200, the Replacement Cost value has changed to 500 which is half of the Purchase Price as per the "CALREPLACECOST" Attribute Launch Point.







5. Enter 50000 in the Purchase Price field.

Click on the red cross for the error message. The error message shows: "BMXZZ0001E - Please enter a value between $20 and $20000 and then press Enter. "








Now the user must click the "Edit My Value" button and enter a cost between $20 and $20000 as per the "PURCHASEPRICE" Attribute Launch Point.

[{"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"System Related","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.6;7.6.0.5;7.6.0.6","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Document Information

Modified date:
17 June 2018

UID

swg21999062