About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Technical Blog Post
Abstract
Automation Script for Maximo Integration Framework (MIF)
Body
Automation Script for Maximo Integration Framework (MIF) is introduced in 7.6 and is a good practice to create and manipulate data. You have the same functionality as the Java Class. But in this case you are not going to lose your class if you upgrade Maximo.
Let’s take a look at a simple example.
Creating an Automation Script for an inbound Object Structure
- Go to System Configuration => Platform Configuration => Automation Scripts.
- Click on Select Action => Create => Script for Integration.
- You have a couple options now. We are not going to cover all options now, but in the near future.
- Select Object Struture
- On Object Structure field we are going to create an example using ITEM. Fill in with MXITEM
- Select Inbound Pocessing
- Select Javascript as a Script Language
- Copy and paste the following code on Source Code. This code just checks if the commodity group of the item is ELEC. If yes, it will fill in the description with the word ELECTRICAL ITEM.
importPackage(Packages.psdi.server); function beforeMboData(ctx) |
- Click on Create button.
Done, the automation is ready to work.
I created a Web Service using the Object Structure MXITEM and sent the xml below:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:max="http://www.ibm.com/maximo"> <soapenv:Header/> <soapenv:Body> <max:SyncMXITEM> <max:MXITEMSet> <max:ITEM action="AddChange"> <max:COMMODITYGROUP>ELEC</max:COMMODITYGROUP> <max:ITEMNUM>PF1002</max:ITEMNUM> <max:ITEMSETID>SET1</max:ITEMSETID> </max:ITEM> </max:MXITEMSet> </max:SyncMXITEM> </soapenv:Body> </soapenv:Envelope> |
This is the result:
Now let’s understand my Javascript code.
I am using the function beforeMboData(ctx), this function already exists on Maximo framework . The beforeMboData(ctx) function is available when the Maximo business object is created but before the values in the business object are set by the integration framework. Processing of the object structure can change the setting of business object data. Processing can also set flags on the fields, such as the samevaluevalidation flag, which triggers field validations even when the field value is set with the current value of the field.
You can find all functions on the link below:
http://www.ibm.com/support/knowledgecenter/SSLKT6_7.6.0/com.ibm.mif.doc/mif_scripting/r_in_functions.html?lang=en
The others methods and the rest of the code, if you already created a Java code for Maximo you will recognize.
TIP: If you need DEBUG your code use the command print. For example:
print(“Test command print”);
This command will print the string on the Systemout log, this is a way to see values of a variable for example.
[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]
UID
ibm11131279