Reload a workorder from server from Workorder detail page
About this task
This guide explains how to add a reload button on workorder detail page to reload the workorder from server having latest data
Procedure
Step 1: In app.xml, Add a button before the work order Edit button.
<button icon="carbon:renew" kind="ghost" padding="false" on-click="reloadWO" disabled="{!app.state.networkConnected}"/>
Step 2: In appCustomizations.js - add a new function to perform the reload operation.
async reloadWO() {const refreshMethod = Device.get().isMaximoMobile ? 'forceSync' : 'forceReload';const datasource = this.app.findDatasource('woDetailResource');if (datasource && datasource[refreshMethod]) {await datasource[refreshMethod]();}}
Step 3: In appCustomizations.js - Import Device module dependency in appCustomizations.js file.
import {Device} from '@maximo/maximo-js-api';
Step 4: (Optional): Alter the adaptive-column’s width in app.xml to adjust spacing for the new button on medium and large screens.
- For the button’s container adaptive-column change
xlarge-width="5" large-width="10"toxlarge-width="15" large-width="20" - and for its previous adaptive-column change
xlarge-width="35" large-width="90"toxlarge-width="25" large-width="80"