Professional Documents
Culture Documents
Anywhere
Author: Ana Biazetti
In my previous blog post, How to add a Maximo related object to IBM Maximo Anywhere, I
provided an example for adding a Maximo related object into a Maximo Anywhere app user
interface (UI). The example added the communications log object, which is related to the work
order, to the Maximo Anywhere Work Execution app. This included:
A view to show the list of communication logs that are related to the work order
A view to show the details of each communication log
This document will build upon that scenario by allowing new communication log records to be
created through the Work Execution app and saved to Maximo, as expected. This exercise
includes:
a new view for the user to input the values for the new commlog
a button on the Work Order Detail View as well as on the CommLogList View to add new
commlog records
a javaScript handler class to include all the handler methods for initializing and validating
the views
a javaScript business object class to initialize and validate new commlog instances
The sections below cover the steps needed to accomplish this. Make sure you have the previous
exercise (How to add a Maximo related object to IBM Maximo Anywhere) working before you start
the steps below.
Step 1. Make changes in Maximo to allow OSLC to work properly with commlog as a record
that can be created by Maximo Anywhere
Step 2.1 Some related records might need adjustments on the OSLC Object
Structure
This step is not required for all types of related records/child records. It is only required for objects
that have autokeys that are also keys on the record.
In this example, commlogid is a required key for commlog records, and it should be restricted
(meaning, not copied from OSLC requests) when creating new records.
To restrict the commlogid:
1. Go To > Integration Framework > Object Structures
2. Find oslcwodetail
3. Select Action > Inbound Setting Restrictions
4. Filter on commlog. Override and mark the commlogid field as restrictedfield.
.
This step is required because when Maximo Anywhere sends transactions to create commlog
records as children of a given workorder, OSLC must receive the commlogid (because it is a
required key)., It then must restrict it to allow Maximo to autokey its value on the record.
Step 2. Import the updated OSLC Resource into the Maximo Anywhere environment
Step 3.2 In the View section, CommLogListView, add the action to create new
CommLog records:
<actions>
<action label="Create Comm Log Entry" transitionTo="WorkExecution.NewCommLogView"
image="header_add_OFF.png">
<eventHandlers>
<eventHandler event="render" method="enableAddCommLogButton"
class="application.customerExtensions.CommLogHandler" />
</eventHandlers>
</action>
</actions>
Step 3.4 In the View section, CommLogDetailView, add the editableView tag:
<view id="WorkExecution.CommLogDetailView" label="Communication Log Entry"
editableView="WorkExecution.NewCommLogView">
Step 3.5 In the data section, commLogResource, add the required attrs to
commLogResource:
<attribute name="anywhereRefId" describedByProperty="spi_wm:anywhererefid" />
<attribute name="commlogid" describedByProperty="spi_wm:commlogid" />
Make sure of the case for the anywhereRefId attribute. The Maximo Anywhere platform depends
on this attribute being defined with this case.
The commlogid is only needed because we will be creating commlog records that have this id as a
required attribute. Other related/children records may not need an id to be added.
Step 4. Create the CommLogHandler and CommLogObject javaScript classes
1. Copy the provided CommLogHandler.js to:
/AnywhereWorkManager/apps/WorkExecution/common/js/application/customerExtensions/Com
mLogHandler.js
2. Copy the provided to CommLogObject to:
/AnywhereWorkManager/apps/WorkExecution/common/js/application/customerExtensions/CommL
ogObject.js
Results
After rebuilding the Work Execution app, you should see the new + buttons on both the
WorkOrder Details view as well as on the CommLog List View, and you should be able to add new
commlogs by clicking on them:
In summary, you can create Maximo related objects in Maximo Anywhere through the use of
configuration and customization. For more information on this and other Maximo Anywhere
configuration examples, please see this link.