The answer is yes (courtesy of Steven Shull):
"Calling a script like you did (/oslc/script/scriptname) is good when it's not done in context of a particular MBO record and when security isn't important. But let's say you have an API creating WOs and then after you want to call an action on it (such as to create a follow up WO) that you also want to call via a REST API.
Inside of the Automation Script application, when you choose Create->Script for Integration and pick the object structure you can choose Action Processing as your event. At that point, you'll have an implicit variable of mbo which will be your MBO record that you can call mbo.createWorkorder() on for example.
From there, you associate the action explicitly on the object structure in the Object Structures application. You do that by opening the Action Definition dialog on the object structure and adding a new row. Choose the implementation type of script and pick your script action. Fill in Name & description as well (I'd suggest reusing the same name like CREATEWO). Now you can provide an option name that would be validated so that user A might be able to call that function but user B would not if they don't have the permission. You can also say something is a collection action if you want them to be able to perform it on a set of records (such as a bulk change status) but I almost never do that.
Now from your script you can call the action on the object. On a collection it would look something like this:
/maximo/oslc/os/mxapiwodetail?action=genreport&reportname=woprint.rptdesign&lean=1&oslc.where=wonum="1022"
On a single record it would look like:
/maximo/api/os/mxapiwodetail/_QkVERk9SRC9SRkFEV1AxMjA4?action=CREATEWO&lean=1
There are the concepts of system actions (such as the genreport that I show for the collection) which are accessible to any object structure. This currently can't be done for automation scripts but is a RFE I submitted that is planned (
https://ibm-ai-apps.ideas.ibm.com/ideas/MASM-I-323).
Two tables to review on patches is RESTSYSACTION & APIROUTE. You can see all the records from APIROUTE inside of the Object Structure application (Add/Modify API Route). You can see some of the RESTSYSACTION by acting like you're going to create a system action on an object structure but it's not all of them (though would cover the more common ones unless you're building an interactive application outside of Maximo)."
Ability to set query definitions and action associations in the Object Structures applicationMaximo NextGen REST API
Original Message:
Sent: Mon November 22, 2021 05:42 PM
From: User1971
Subject: Create actions to invoke on an object structure
MAM 7.6.1.2:
I learned recently that it's possible to call an automation script via a URL:
Python script:
responseBody = "asdf"
Then just run the URL in a browser (or somewhere else like an automation script in Maximo or a Python script in GIS).
https://<<my host>>/maximo/oslc/script/testscript
Question:
Is it possible to create actions to invoke on an object structure?
#AssetandFacilitiesManagement
#Maximo