Hi there,
I found a solution to update this question. Since there is a dependency between the edit page and the datasources on the details page, I discovered that loading the details page the first time and then allowing the user to click on the edit button from the list page for the following actions will skip the details page. This allows the user to jump to the edit page directly without navigating to the details page.
/* @param {Object} event - item: workorder, datasource: wodetails */
async OpenEditPage(event) {
let workorder = event.item;
let woDetailsResource = this.app.findPage('workOrderDetails').findDatasource('woDetailResource');
// If woDetailsResource is undefined, it means we need to load the details page first
if (!woDetailsResource) {
this.page.callController('showWODetail', workorder);
} else {
let woDetails = this.app.findDatasource(event.datasource.name);
await woDetails.load({ noCache: true, itemUrl: event.item.href });
let woSchema = woDetails.getSchema();
if (workorder && (workorder.wonum || workorder.href)) {
this.app.setCurrentPage({
name: 'woedit',
resetScroll: true,
params: {
workorder,
woSchema,
wonum: workorder.wonum,
istask: workorder.istask,
wogroup: workorder.wogroup,
taskid: workorder.taskid,
prevPage: 'schedule',
},
});
if (this.app.currentPage) {
// Custom loadRecord, but can use OOTB from the edit controller
this._loadRecord(workorder, woSchema);
}
}
}
}
Additionally, if you need to go back to the list page instead of the details page, you can override the default navigation on your applicationInitialized in the AppCustomization.js
applicationInitialized(app) {
this.app = app;
this.app.on('page-changed', (nextPage, prevPage) => {
// Going back to schedule from woedit page on save/discard if navigated from schedule
if (
prevPage.name === 'woedit' &&
prevPage.params.prevPage === 'schedule' &&
(nextPage.name === 'schedule' || nextPage.name === 'workOrderDetails')
) {
this.app.setCurrentPage({
name: 'schedule',
});
}
});
}
I hope this can help someone.
Cheers.
------------------------------
Maycon Belfort
Consultant
BPD Zenith
Melbourne
Australia
------------------------------
Original Message:
Sent: Mon May 15, 2023 02:27 AM
From: Maycon Belfort
Subject: Maximo Mobile 8.10 - Edit WO by passing the WO Detail View
Hi everyone,
Any idea how I can open the edit WO screen from the list bypassing the WO Details screen? The idea is to create a new edit button in the wo-card and, when clicking it, open the edit view.
I'm currently using Maximo Mobile 8.10, and this is what I tried to do, but I'm breaking the page due to internal validations on WorkOrderDataController.
# on AppCustomizations.jsasync myOpenEditPage(event) { let workorder = event.item; let woDetailsPage = this.app.findPage('workOrderDetails'); woDetailsPage.runInitializers() let woDetailResource = woDetailsPage.getDatasource('woDetailResource'); await woDetailResource.load({ noCache: true, forceSync: true, itemUrl: workorder.href, }); let woSchema = woDetailResource.getSchema(); if (workorder && (workorder.wonum || workorder.href)) { woDetailsPage.state.woDetail = { page: 'workOrderDetails', wonum: workorder.wonum, siteid: workorder.siteid, href: workorder.href, }; this.app.setCurrentPage({ name: 'woedit', resetScroll: true, params: { workorder, woSchema , wonum: workorder.wonum, istask: workorder.istask, wogroup: workorder.wogroup, taskid: workorder.taskid }, }); if (this.app.currentPage) { this.app.currentPage.callController('loadRecord', workorder); } } }
Thank you.
------------------------------
Maycon Belfort
Consultant
BPD Zenith
Melbourne
Australia
------------------------------