150818 jython rocks maximo - creating script v1.0
Post on 11-Jan-2016
227 Views
Preview:
DESCRIPTION
TRANSCRIPT
© 2015 IBM Corporation
Create Script (hardcopies)
in IBM Maximo Automation Script
Carsten Frentz-Bernt
Senior Client Technical Professional / Maximo Asset Management
Analytics / Internet of Things
IBM Deutschland GmbH
18. August 2015
© 2015 IBM Corporation2
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.
Components of automation scripts
For a script to run, you specify the following components:
Launch point
A launch point defines the execution context for a script, for example when a business object is
updated or a value is entered into a field. Five types of launch point are supported and the Automation
Scripts application provides a separate wizard application for creating each type of launch point.
Variables and binding values
You can specify the variables that determine how information is passed into or received from a script in
the wizard applications. Variables are not mandatory, but when you use variables it simplifies the
amount of code to be written and is easier to reuse the code.
Source code
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, version 1.6 release 2
Jython, version 2.5.2
Automation Scripts Application
© 2015 IBM Corporation3
A launch point is a complete script configuration. The configuration consists of the target application or
context, the variables that are passed between the application and the script, and the body of the script.
You can create a script and associate a launch point to the script. Alternatively, you can create a launch
point and associate it to variables and scripts. You can share a script among multiple launch points and you
can promote scripts and launch points from development to production by using Migration Manager.
When a launch point is deactivated, the scripts associated with that launch point do not run. To debug an
application, you can deactivate a launch point to test the behavior of the application without the script.
The status of the automation script does not affect how the scripting framework executes the script. A script
in draft status is treated the same way as a script with a status of Active.
Launch Points I
© 2015 IBM Corporation4
Script with an object launch point
An object launch point associates a script with a business object and executes in response to a business
object event. Events are associated with a specific context so that the script executes before or after the
object is saved or after it is committed to the database. You can, optionally, associate an event with a
condition and limit execution to circumstances where the condition is satisfied.
Script with an attribute launch point
An attribute launch point associates a script with a specific field of a business object and an event occurring
against that field, and executes only when a value is specified for that field.
Script with an action launch point
An action launch point associates a script with an action and executes when the specified action occurs.
Use the Actions application to configure the associated action.
Script with a custom condition launch point
A custom condition launch point associates a script with a custom condition and executes when the
condition is satisfied. Use the Conditional Expression Manager application to configure the associated
condition.
Script without a launch point
You can enter a script in the Automation Scripts application without associating it with a launch point. This
approach is useful, for example, if you want to import a library of scripts that you intend to configure at a
later stage. Other examples of a script without a launch point are automation scripts that are run as cron
tasks and object structure scripts.
Launch Points II
missing
Integration Launch Point !
© 2015 IBM Corporation5
Variables determine how information is passed into or received from a script. You can configure the
variables for the script in the wizards instead of declaring variables within the source code. By using
variables, you reduce the complexity of the source code and make it easier to reuse the source code for
different purposes.
Launch point variables
When you create a launch point you can declare as many variables as required. After you create a script,
you can add more variables or modify existing variables.
Implicit variables
Implicit variables are variables that you do not define. These variables are automatically provided by the
framework. Some implicit variables are valid only when associated with a declared variable while others are
not associated with any other variables.
Data retrieval by using variable bindings
You use variable bindings to retrieve values for the variables in the script. When variables are bound to
business object attributes, the coding required in the script is simplified.
Variables in Automation Scripts
© 2015 IBM Corporation6
When you create a launch point you can declare as many variables as required. After you create a script, you can add more
variables or modify existing variables.
When you declare a variable you must specify it as one of the following types:
IN Passes information into the script.
OUT Passes information out from the script.
IN/OUT Passes information into the script and returns information from the script.
The script can modify only the INOUT and OUT type of variables.
Modification of IN variables in the script has no impact outside the script.
When you create a script with an object launch point, you specify one or more events and the event context when the script is
activated. If a script runs after the business object is saved, or after the business object is committed to the database, the
only relevant variable type in the context is the IN variable type.
Variables have bindings that identify the source of the value for the variable. Variables can have a global binding value that is
common to all launch points that are associated with the script. You can override the global binding value for specified launch
points. The following table lists the binding types and values that you can use:
Launch point variables
© 2015 IBM Corporation7
Implicit variables
© 2015 IBM Corporation8
Data retrieval by using variable bindings
© 2015 IBM Corporation9
Create Script (without associating it with a launch point)
© 2015 IBM Corporation10
Create Script with Object Launch Point : Step 1 of 3
© 2015 IBM Corporation11
An object launch point can be based on any object in the database, and you must associate it with one of the following events:
Initialize value
Indicates whether the script is executed by the initialize event.
Validate application
Indicates whether the script is executed by the validate event.
Allow object creation
Indicates whether new Maximo® business objects can be created. For example, your business logic can state that when a purchase order is
approved, new POLINE objects cannot be created. Only one launch point can be defined for the selected Maximo business object and the Allow object
creation event.
Allow object deletion
Indicates whether Maximo business objects can be deleted. For example, your business logic can state that when a work order is approved,
WOLINE objects cannot be deleted. Only one launch point can be defined for the selected Maximo business object and the allow object deletion event.
Save
Indicates whether the script is executed by the save event.
If you select the Save radio button, you must specify the context for the save in the Save section.
The save event can be executed in any of the following contexts:
Before save
The script is executed and sets values on the business object before the underlying transaction is saved. For example, you can apply a business rule
that checks if a specific naming convention has been followed when a new record is being saved. If the naming convention rule has not been followed,
the save activity is not allowed and the user receives an error message.
After save
The script is executed after the business object is saved to the database but before the changes are committed. This event context enables you to
incorporate a business rule and roll back processing on a transaction if necessary. For example, in an integration scenario, if a transaction update to an
external system fails due to a connection issue, the initial transaction can be rolled back so that both databases remain synchronized.
After commit
The script is executed after a transaction has been committed to the database and cannot be rolled back. This event context is typically used to
initiate additional actions immediately after the commit of a particular business object. For example, a script initiates sending email notifications when a
work order is completed or sends an integration message to notify an external system when a purchase order is created.
Create Script with Object Launch Point : Step 1 of 3
© 2015 IBM Corporation12
Create Script with Object Launch Point : Step 2 of 3
© 2015 IBM Corporation13
Create Script with Object Launch Point : Step 3 of 3
© 2015 IBM Corporation14
You can associate an attribute launch point with the
following events on a field:
Initialize access restriction
Sets the access level for the attribute's field. For
example, you can change the access level for an
attribute's field from read/write access to read-only
access.
Initialize value
Sets the value for the attribute's field. For example,
you can automatically enter the account number for an
existing customer.
Validate
Checks whether the value in the attribute's field is
valid. For example, you can check whether a
telephone number is properly formatted or contains
enough digits to constitute a valid number.
Retrieve list
Retrieves a list of valid values for the attribute's
field. For example, in an invoice, you can set up the
supplier field to return a list of approved vendors.
Run action
Runs an action that is based on the value that is in
the attribute's field.
Create Script with Attribute Launch Point : Step 1 of 3
© 2015 IBM Corporation15
Create Script with Attribute Launch Point : Step 2 of 3
© 2015 IBM Corporation16
Create Script with Attribute Launch Point : Step 3 of 3
© 2015 IBM Corporation17
Create Script with Action Launch Point : Step 1 of 3
© 2015 IBM Corporation18
Create Script with Action Launch Point : Step 2 of 3
© 2015 IBM Corporation19
Create Script with Action Launch Point : Step 3 of 3
© 2015 IBM Corporation20
Script with Custom Condition Launch Point : Step 1 of 3
© 2015 IBM Corporation21
Script with Custom Condition Launch Point : Step 2 of 3
© 2015 IBM Corporation22
Script with Custom Condition Launch Point : Step 3 of 3
© 2015 IBM Corporation23
Create Script for Integration
© 2015 IBM Corporation24
Create Script for Integration – Object Structure
© 2015 IBM Corporation25
Create Script for Integration – Publish Channel
© 2015 IBM Corporation26
Create Script for Integration – Enterprise Service
© 2015 IBM Corporation27
Create Script for Integration – Innvocation Channel
© 2015 IBM Corporation28
Carsten Frentz - Bernt
Senior Client Technical Professional
Analytics / Internet of Things
IBM Deutschland GmbH
+49 172 742 65 22
carsten.frentz@de.ibm.com
© 2015 IBM Corporation29
Legal Disclaimer
• © IBM Corporation 2015. All Rights Reserved.
• The information contained in this publication is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained
in this publication, it is provided AS IS without warranty of any kind, express or implied. In addition, this information is based on IBM’s current product plans and strategy, which are
subject to change by IBM without notice. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing
contained in this publication is intended to, nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and
conditions of the applicable license agreement governing the use of IBM software.
• References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or
capabilities referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment
to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by
you will result in any specific sales, revenue growth or other results.
• If the text contains performance statistics or references to benchmarks, insert the following language; otherwise delete:
Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will
experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage
configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.
• If the text includes any customer examples, please confirm we have prior written approval from such customer and insert the following language; otherwise delete:
All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs
and performance characteristics may vary by customer.
• Please review text for proper trademark attribution of IBM products. At first use, each product name must be the full name and include appropriate trademark symbols (e.g., IBM
Lotus® Sametime® Unyte™). Subsequent references can drop “IBM” but should include the proper branding (e.g., Lotus Sametime Gateway, or WebSphere Application Server).
Please refer to http://www.ibm.com/legal/copytrade.shtml for guidance on which trademarks require the ® or ™ symbol. Do not use abbreviations for IBM product names in your
presentation. All product names must be used as adjectives rather than nouns. Please list all of the trademarks that you use in your presentation as follows; delete any not included in
your presentation. IBM, the IBM logo, Lotus, Lotus Notes, Notes, Domino, Quickr, Sametime, WebSphere, UC2, PartnerWorld and Lotusphere are trademarks of International
Business Machines Corporation in the United States, other countries, or both. Unyte is a trademark of WebDialogs, Inc., in the United States, other countries, or both.
• If you reference Adobe® in the text, please mark the first use and include the following; otherwise delete:
Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States, and/or other
countries.
• If you reference Java™ in the text, please mark the first use and include the following; otherwise delete:
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
• If you reference Microsoft® and/or Windows® in the text, please mark the first use and include the following, as applicable; otherwise delete:
Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both.
• If you reference Intel® and/or any of the following Intel products in the text, please mark the first use and include those that you use as follows; otherwise delete:
Intel, Intel Centrino, Celeron, Intel Xeon, Intel SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States
and other countries.
• If you reference UNIX® in the text, please mark the first use and include the following; otherwise delete:
UNIX is a registered trademark of The Open Group in the United States and other countries.
• If you reference Linux® in your presentation, please mark the first use and include the following; otherwise delete:
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of
others.
• If the text/graphics include screenshots, no actual IBM employee names may be used (even your own), if your screenshots include fictitious company names (e.g., Renovations, Zeta
Bank, Acme) please update and insert the following; otherwise delete: All references to [insert fictitious company name] refer to a fictitious company and are used for illustration
purposes only.
top related