This blog will walk you through the process of creating a Workorder using the SiteId of the chosen Asset rather than the user's default SiteId. When loading assets from different sites onto mobile and creating a workorder for an asset that is not under the user's default SiteId, this is useful.
This also includes a helpful example of how to override a controller method when customizing your Maximo Mobile applications.
pageInitialized(page, app) {
if (["createwo", "woedit"].includes(page.name)) {
let controller = page.controllers[0];
const datasourceName = page.name === "createwo" ? "dsCreateWo" : "dsWoedit";
const orgChooseAssetItem = controller.chooseAssetItem.bind(controller);
const orgChooseAsset = controller.chooseAsset.bind(controller);
// When the user types a known asset in the input box
controller.chooseAssetItem = (item) => {
orgChooseAssetItem(item);
app.findDatasource(datasourceName).item.siteid = item.siteid;
};
// When the user selects an asset from the lookup
controller.chooseAsset = (item) => {
orgChooseAsset(item);
app.findDatasource(datasourceName).item.siteid = item.siteid;
};
}
}
#MaximoMobile #Technician #MobileCustomization #CreateWorkorder #Mobile #WorkExecution