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
------------------------------