IBM Maximo Customization Scripting and Formulas
IBM Maximo Customization Scripting and Formulas
Oct 2018
Sean Stuckless
[email protected]
Who is this guy?
20 Years with
IBM
8 Years
12 Years with
Online
Maximo
Commerce
Developer Public
Scheduler KPIs Frameworks Supply Chain frameworks Integration
Engagement Mapping
2
DISCLAIMER
IBM’s statements regarding its plans, directions, and intent are subject to
change or withdrawal without notice at IBM’s sole discretion. Information
regarding potential future products is intended to outline our general product
direction and it should not be relied on in making a purchasing decision.
The information mentioned regarding potential future products is not a
commitment, promise, or legal obligation to deliver any material, code or
functionality. Information about potential future products may not be
incorporated into any contract. The development, release, and timing of any
future features or functionality described for our products remains at our sole
discretion.
3
Scripting and Formulas
4
Scripting and Formulas
Can Delete
Actions Execute
Can Add Insert
Before
Save Update
Objects After
Duplicate Delete
After Commit
App Validate
Global Service Init On Setup
MIF/REST
Scripts
Library Script Init
Init Value
Attributes Action
Validate
7.6.0.5+
Conditions Get List
7.6
7.5
CRONs
5
Global 'service' var
logging
Invoke
channel
workflow
Real Time
Error
service var
Warning
Library script
service.error(grp,key)
service.error(grp,key,params)
service.setWarning("po","nolines", None)
service.yncerror("asset", "assetpr",params)
service.invokeChannel(channelname)
Object
In
Structures
Query Before
(REST) Ext Exit
MIF Endpoints Action
Request User Exit
(REST)
After Ext
Exit
Enterprise
External
Service Response
Exit
External
Exit Before
MIF/REST Ext Exit
Publish
User Exit
Channel Before
After Ext
Event Exit Ext Exit
Filter User Exit
Request
After Ext
Invoke Channel Exit
7.6.0.5+
Response External
Exit 7.6
MMI 7.5
8
New in 7.6.1
Support for
Better support
Library Scripts Closing
for add-on Easier to use
Jython 2.7 with Multiple Maximo
module in Library Scripts
Functions Dialogs ('action'
Jython
Launchpoint)
9
Reusing Scripts – Library Scripts
❖ Current way to write Library Scripts.
Script 1 – CALC_MULT
r = a*b
Script 2 – CALC_ADD
r = a+b
10
Reusing Scripts – Library Scripts
❖ Current way to consume such a Library Script.
11
Reusing Scripts – Library Scripts
❖ What you can do now (make sure that you set the script to Allow
Invoking Script Functions).
Script - CALC
def mult(a,b):
return a*b
def add(a,b):
return a+b
12
Reusing Scripts – Library Scripts
❖ The script to consume it.
res = service.invokeScript("CALC","mult",[2,3])
13
14
Scripting Performance and Common Problems
14
Dev Center + Future
15
Formulas
Formulas
17
Formulas vs Scripting vs Java
C = f(A,B) - Java
A
Code
C
Code
B
Code
A
Script
C
Script
B
Script
C
Formula
B
• Single Function
• Configured in Database Application
• C auto-magically updated when A or
B Change
Formulas in Maximo
22
Example: Using Conditional Logic
➢ Nested Logic
➢ Relationships using the $ operator
➢ Implicit type conversion from ALN to double, boolean, date
23
Formulas - Prefixes
24
Formulas – Aggregation and Collections
25
26
When to use Formulas vs Scripting
➢ Formula
➢ Mathematical Calculation
➢ Scripting
➢ Validation
➢ Complex Updates (if then else)
➢ Business Logic
26
27
Formula Performance and Common Problems
27
THANK YOU