As I mentioned above, I would NOT do this on the out of the box tasks page. You should add your own tasks page or a sliding drawer mechanism for editing. If this was a page where we enabled users to edit fields, then adding new fields wouldn't be a problem. But because we're managing this state variable for our own purposes in this app, you're not going to be able to manage the state variable the way you need.
Original Message:
Sent: Mon May 27, 2024 10:58 PM
From: Amir Anwar
Subject: Maximo Mobile 8.10 - Want to show SAVE/DISCARD message on task page when user clicks on back icon(top left) in order to go back to wo details page
Hi Ritesh,
I am in a similar position - adding custom fields to tasks page. Did you manage to get discard warning working ? Also, can you please share the code behind the custom save button.
Thanks,
------------------------------
Amir Anwar
Original Message:
Sent: Mon March 25, 2024 02:31 AM
From: Ritesh Ranjan
Subject: Maximo Mobile 8.10 - Want to show SAVE/DISCARD message on task page when user clicks on back icon(top left) in order to go back to wo details page
Hi Steven,
Thanks for the response.
Below is the task screen, which has been modified. These are just two Smart-inputs. On top right corner, custom save button was created to save these inputs.
Now when user modifies one of the inputs and click on back icon (top left) without clicking on custom save button, then this page does not give any prompt.
For custom save button, have written the logic in AppCustomization.js.
As per the suggestion, I added the state useconfirmdialog as true in the tasks page.
<page controller="TaskController" id="tasks">
<states id="ma9kb">
<state name="useConfirmDialog" value="true" type="boolean" id="avw9b"/>
</states>
Did the preview. I modified one of the input and clicked on back icon, it does not give any prompt for Save/Discard.
Please advise if I am missing anything.
Note: I saw 8.11 documentation, but it just says about defining states and nothing else.
------------------------------
Ritesh Ranjan
Original Message:
Sent: Sat March 23, 2024 02:05 PM
From: Steven Shull
Subject: Maximo Mobile 8.10 - Want to show SAVE/DISCARD message on task page when user clicks on back icon(top left) in order to go back to wo details page
On your page, have the useConfirmDialog setup as a state variable. When this is true, we should prompt you to save. This will call a traditional save on the datasource (not executing special logic that you might have on your save button). If you need to execute special logic, there is an onCustomSaveTransition function that you can declare in a controller (I don't think it's possible to put in AppCustomizations.js, though I haven't tried) to execute special logic when the save option is picked in the dialog.
If you're on 8.11 in the config image, this topic is covered on the "Managing data on a page" under Developing with Graphite section of the developer wiki.
------------------------------
Steven Shull
Original Message:
Sent: Thu March 21, 2024 09:09 AM
From: Ritesh Ranjan
Subject: Maximo Mobile 8.10 - Want to show SAVE/DISCARD message on task page when user clicks on back icon(top left) in order to go back to wo details page
Hi All,
Looking for some guidance with below issue.
I have added some input fields in task page. I have also custom save button which works fine.
User can input the data in those fields and then user needs to click on custom save button which in turn save data in core maximo database.
But if user do not click on save after providing the inputs and click on that back icon to go back to workorder details page, then those input data don't get saved. So looking for way to show the message to the user like we get in create workorder page in mobile if you try to go back without saving the workorder.
Please help, Thanks.
------------------------------
Ritesh Ranjan
------------------------------