Introduction to Scripting in Maximo! April 2016

Introduction to Scripting in Maximo! April 2016 Agenda •  •  •  •  •  •  What are Automation Scripts Key concepts Examples Are Automation Scripts t...
Author: Merilyn Parker
14 downloads 4 Views 1MB Size
Introduction to Scripting in Maximo! April 2016

Agenda •  •  •  •  •  • 

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

1

What are Automation Scripts? •  •  • 

•  •  • 

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

2

Key Concepts Launch Points •  Object Launch Point •  • 

• 

Attribute Launch Point • 

• 

Execute scripts in the context of workflow/escalation actions, UI menus and buttons

Custom Launch Point • 

• 

Execute scripts during field validations

Action Launch Point • 

• 

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

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

3

Key Concepts 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

4

Key Concepts 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

5

Example 1 – Automation Script with Attribute Launch Point 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

6

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

7

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

8

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

9

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.

10

Example 2 – Automation Script with Object Launch Point 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.

11

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

12

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.

13

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

14

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

15

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

16

Are Automation Scripts the right solution? 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

17

Are Automation Scripts the right solution? 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? 18

Are Automation Scripts the right solution? 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

19

Reference Links •  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

20

Q&A!

Back-up

22

Scripting architecture in 7.5

23