24
Introduction to Scripting in Maximo April 2016

Lacey radabaugh automation scripting

  • Upload
    sun-kim

  • View
    36

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Lacey radabaugh automation scripting

Introduction to Scripting in Maximo!April 2016

Page 2: Lacey radabaugh automation scripting

1

•  What are Automation Scripts •  Key concepts •  Examples •  Are Automation Scripts the right solution? •  Reference links •  Q&A and sharing of how you are using Automation Scripts

Agenda

Page 3: Lacey radabaugh automation scripting

2

•  Automation scripts are small, targeted pieces of code that can be authored, saved and instantly activated in a TPAE-based product environment to extend the product.

•  Automation scripts were first introduced with the 7.5 release of TPAE. •  With the Automation Scripts application, you can create scripts to automate tasks

based on the events or attributes of a business object, or based on actions or custom conditions or via integration. You can create a script in any of several supported scripting languages, and execute the script without having to recompile Java files or restart the server.

•  Automation scripts are supported •  Automation scripts are upgradeable •  Many of your java extensions may be able to be replaced with scripts

What are Automation Scripts?

Page 4: Lacey radabaugh automation scripting

3

Launch Points •  Object Launch Point

•  Execute scripts on MBO events such as init, add, update, or delete •  Execute scripts conditionally (based on criteria)

•  Attribute Launch Point •  Execute scripts during field validations

•  Action Launch Point •  Execute scripts in the context of workflow/escalation actions, UI menus and buttons

•  Custom Launch Point •  Workflow conditions and conditional expressions can be enabled

•  Integration (new in 7.6) •  Use of scripting enabled on multiple integration components where support for custom

java classes previously existed and still exist

Key Concepts

Page 5: Lacey radabaugh automation scripting

4

Variables

•  Variables enable data to be passed to and returned from Script

•  Exploiting variables simplifies script code

•  Variables have these characteristics: •  Variable Type: IN (passed to) or OUT (returned from) or INOUT (both) •  Variables of type OUT are set back into a business object •  When setting back to business object the following can be controlled: –  Allowing or suppressing validation –  Allowing or suppressing access control –  Allowing or suppressing action

•  Bind variables to MBO attributes, system properties, MAXVARs or literals

Key Concepts

Page 6: Lacey radabaugh automation scripting

5

Script •  You can write source code in an external application and import it into

the Automation Scripts application •  Alternatively, you can enter code directly into the Source Code field in

the wizard applications •  The source code must be written in the languages that are supported

by the following script engines: Mozilla Rhino or Jython

Key Concepts

Page 7: Lacey radabaugh automation scripting

6

Issue: If there is only one asset residing at a location in Maximo and a work order is created against the location, the asset is automatically populated too. However, I don’t want the asset to automatically be populated. Solution: create an automation script with an attribute launch point to clear the asset field when the location is populated

Example 1 – Automation Script with Attribute Launch Point

Page 8: Lacey radabaugh automation scripting

7

Go To > System Configuration > Platform Configuration > Automation Scripts. Create > Script with Attribute Launch Point

Page 9: Lacey radabaugh automation scripting

8

Specify Object of Work Order with Attribute of Location. After filling in the location field, the Script will be launched.

Page 10: Lacey radabaugh automation scripting

9

Define an INOUT Variable binded to the Asset Number field. This is the field that will be set to null when the script is triggered by populating the location field

Page 11: Lacey radabaugh automation scripting

10

Define the script to set the asset field to null if there is a value populated. Remember script only triggers when you populate location attribute.

Page 12: Lacey radabaugh automation scripting

11

Issue: I use the start / stop timer to allow my technicians to capture time. I don’t want to allow a work order to be completed or closed if open labor transactions exist on the work order. Solution: create an automation script with an object launch point and condition to display a customer defined error message if a work order is being completed or closed and open labor transactions exist.

Example 2 – Automation Script with Object Launch Point

Page 13: Lacey radabaugh automation scripting

12

Object is work order and Event Condition limits the script to trigger only when completing or closing a work order

Page 14: Lacey radabaugh automation scripting

13

Define an IN variable to evaluate if there are any open labor transactions. The * indicates an array meaning it searches for all instances. It is an important concept, especially for cost roll-ups.

Page 15: Lacey radabaugh automation scripting

14

Define the script to display the error message if there are open labor transactions

Page 16: Lacey radabaugh automation scripting

15

You can define new error messages with text that makes sense to the user based on the situation

Page 17: Lacey radabaugh automation scripting

16

Demo – when trying to complete a work order with an open labor transaction, the error message is displayed

Page 18: Lacey radabaugh automation scripting

17

There are many other tools in Maximo – understand the tools available. Scripting is not always the right solution. •  Signature options •  Global data restrictions •  Security group data restrictions •  Conditional expressions •  Conditional user interface •  Escalations •  Workflow •  Domains •  Application Designer

Are Automation Scripts the right solution?

Page 19: Lacey radabaugh automation scripting

18

Example requirement: The problem code should be required for corrective maintenance work orders Solution: Automation script? Global data restriction with conditional expression? Conditional user interface? Example requirement: technicians should not be able to complete a corrective work order if failure reporting is not captured Solution: Automation script? Conditional expression tied to status in synonym domain? Conditional expression tied to signature option to complete work order in Security Group application for technicians? Global data restriction with conditional expression that included security group names? Set maxvar on COMP status to give failure prompt in Organizations application?

Are Automation Scripts the right solution?

Page 20: Lacey radabaugh automation scripting

19

Recommendations •  Understand all the tools available in Maximo •  Understand all the functionality available in Maximo •  Be consistent. This will help with troubleshooting down the road

Are Automation Scripts the right solution?

Page 21: Lacey radabaugh automation scripting

20

•  Automation Scripts knowledge center https://www.ibm.com/support/knowledgecenter/SSLKT6_7.6.0/com.ibm.mbs.doc/autoscript/t_ctr_automate_routine_app_tasks.html?cp=SSLKT6_7.6.0 •  Automation Scripts wiki https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20Maximo%20Asset%20Management/page/Customizing%20with%20automation%20scripts •  In depth presentation with examples on Automation Scripts http://www-01.ibm.com/support/docview.wss?uid=swg27028563 ftp://ftp.software.ibm.com/software/tivoli_support/misc/STE/2012_08_14_STE_Scripting.pdf •  Conditional user interface https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20Maximo%20Asset%20Management/page/Conditionally%20changing%20user%20interface%20properties

Reference Links

Page 22: Lacey radabaugh automation scripting

Q&A!

Page 23: Lacey radabaugh automation scripting

22

Back-up

Page 24: Lacey radabaugh automation scripting

23

Scripting architecture in 7.5