I've been asked a few times for how to enable multi-select with automation scripts so I wanted to document it in a blog post for others to find. I'm going to provide a little background and then provide an end to end example on how to configure.
Background:
There are scenarios in Maximo where a user might want to be able to select multiple values from a dialog to associate to a record. For example, in the Purchase Order application you can select 1 or more Purchase Requisition lines to copy over to the Purchase Order. When you need functionality like this in your own application, this has been hard to do well with automation scripts even though most of the functionality has been available since 7.5 because you weren't able to close the dialog for the user from your automation script. With the additional functionality added to Automation Scripts to support UI interactions in 7.6.1.X of Maximo, this is now easy to do without java classes while still providing a good user experience.
My example will enable a user to select multiple assets in a lookup dialog and associate the selected assets as a comma separated list to a new custom attribute on WORKORDER. Instead of an attribute storing a comma separated list, if you're actually looking to implement this I would recommend storing each selection on a child object instead. The advantage to a child object is you can easily index & search for
Steps to Implement
1) Create an attribute (EMXSELECTEDASSETS) on the WORKORDER object with a length of 250 characters to support selecting multiple values. Again, I would NOT recommend this approach for an actual implementation due to the inability to index and search on this data effectively. You should utilize a child object instead of a single attribute.
2) Create a dialog in the library.xml that references the MultiselectDataBean. My example is below. Note that the datasrc for the dialog itself is MAINRECORD (IE the WO record that we’re starting from). The table utilizes a relationship (ALLASSETS) to determine which assets to be displayed for the WORKORDER. The default button is emxselassets which will correspond to our signature option & automation script. Because I associated this as a lookup to my attribute I had to add "lookup_" to the ID. It’s just a naming standard when referencing a lookup that exists in the library.xml. When you refer to the lookup in the application you do NOT provide lookup_, just the value after (emxassetlookup in this case).
<dialog beanclass="psdi.webclient.system.beans.MultiselectDataBean" id="lookup_emxassetlookup" label="Select Assets" datasrc="MAINRECORD">
<table id="emxselassets_table" label="Assets" selectmode="multiple" relationship="ALLASSETS">
<tablebody displayrowsperpage="15" filterable="true" id="emxselassets_table_tablebody" inputmode="readonly">
<tablecol filterable="false" hidden="false" id="emxselassets_table_tablebody_1" mxevent="toggleselectrow" sortable="false" type="event"/>
<tablecol dataattribute="assetnum" id="emxselassets_table_tablebody_2"/>
<tablecol dataattribute="description" id="emxselassets_table_tablebody_3"/>
<tablecol dataattribute="siteid" id="emxselassets_table_tablebody_4" lookup="site"/>
</tablebody>
</table>
<buttongroup id="emxselassets_2">
<pushbutton default="true" id="emxselassets_2_1" label="Select Assets" mxevent="emxselassets"/>
<pushbutton id="emxselassets_2_2" label="Cancel" mxevent="dialogcancel"/>
</buttongroup>
</dialog>
3) In the application (my example is WOTRACK), create a new signature option that will be the same name as your automation script action. In my case, the EMXSELASSETS. Make sure that you choose "this is an action that must be invoked by the user in the UI" so the script will fire.
#MaximoIntegrationandScripting#AssetandFacilitiesManagement#Maximo