Object structure action

When you call a custom action on your Maximo business object (MBO) or MboSet from the REST API, you can define an object structure action.

The following table lists the implicit variables.
Table 1. Implicit variables
Variable name Description
request OslcRequest representation of the request that is made. This variable shows methods such as request.getQueryParam(“parameter”) and request.getHeader(“header”) to retrieve values that are provided as a query parameter or header. You can also access the User Info by calling request.getUserInfo().
requestBody The body of the request if one was provided.
httpMethod Whether this action was a GET, POST, PUT, and so on. Can also be retrieved by calling request.getHttpMethod().
mbo This variable is the MBO for the main object of the object structure.
mboset This variable is the MboSet for the main object of the object structure.

In the Automation Scripts application, click Create > Script for Integration and choose the object structure. Select Action Processing and give it a unique name. Provide the script source.

In the Object Structures application, open the object structure. From More Actions, click Action Definition and add a new row.

Provide a name and description. It is best to set the action name to match the script action name, which is SENDCOMM in the example. Set the implementation type to script and select the script that was created previously. Optionally, select the Collection Action option if your action is used on the set, which does not require a specific record. Optionally, provide an option name if you want to restrict this to a signature option. Tie it to the Save permission if it modifies the record.

The following is an example script.
template=request.getQueryParam("template")
if template:
    commMbo=mbo.createComm()
    commMbo.setValue("TEMPLATEID", template)
    commMbo.sendMessage()
Call with a POST request like the following example:
https://myurl.com/maximo/api/os/mxapisr/_U1IvMTA2Nw--?lean=1&action=SENDCOMM&template=1014
Note: Use the x-method-override header of PATCH when you act on an existing record.