Disable delete button for errored transaction
About this task
This guide details a step-by-step approach to controlling the ability of the delete button action for errored transactions in IBM Maximo Mobile by configuring specific files and setting up a signature option (sigoption). This configuration takes place at Navigator app
Procedure
Step 1: Define the Signature Option (Sigoption) to control the delete button, start by creating a new sigoption named WO_DELETEERROR_TRX for the mxapiwodetail object structure.
Follow these steps in the Object Structures application under Configure Object Structure Security:
- Open the Object Structures application from the IBM Maximo main menu.
- Search for and select the mxapiwodetail object structure.
- In the toolbar, click on the Action menu and select Configure Object Structure Security.
- In the Configure Object Structure Security dialog, click New Row to add a new signature option.
- In the Option Name field, enter WO_DELETEERROR_TRX.
- Provide a description, such as “Control of delete button for errored transactions.”
Step 2: After creating this sigoption, assign the correct permissions in the Security Groups application:
- Open the Security Groups application.
- Locate the relevant security group(s) to which this permission should be granted.
- Under the Object Structures tab, select the mxapiwodetail object structure.
- Find the WO_DELETEERROR_TRX sigoption and grant the appropriate access level to control of the delete button for errored transactions.
Step 3: Modify the App.xml File from the Navigator application. Locate the delete button (id=“a38re”) in the App.xml file. Add a disabled attribute to the button, linked to a custom property that will control its state based on the sigoption.
<button id="a38re" disabled="{item.disabled}">Delete</button>
Step 4: Configure the AppCustomizations.js. Use the applicationInitialized(app) event to capture the value of sigoption WO_DELETEERROR_TRX for the current application instance and store it in a class variable for later use. This will determine if the delete option is permitted.
applicationInitialized(app) {// Store the delete permission for error transactionsthis.canDeleteError = this.app.checkSigOption(`${this.app.state.woOSName}.WO_DELETEERROR_TRX`);}
Step 5: Use the onAfterLoadData event to iterate over each item in the syncTranscationDS datasource. This allows you to set the disabled attribute based on the sigoption value and transaction properties.
onAfterLoadData(datasource, items, query) {if (datasource.name === 'syncTranscationDS'){// First we collect the datasources presenting errorslet erroredTxObjDS;for (const {errors} of items) {// errors is the datasource name that contain errored transactions from a particular objectif (errors) {erroredTxObjDS = this.app.findDatasource(errors);if (erroredTxObjDS?.items?.length) {
The code above will disable the delete button for errored transactions from the WORKORDER collection if deletion is not allowed based on the sigoption. The visibility of the delete button can be adjusted at any time by an administrator through the Security Groups application. By changing the WO_DELETEERROR_TRX sigoption setting for the relevant security group, administrators can dynamically control whether users can delete errored transactions.