Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  MAS Mobile - Enhancing the "My Schedule" [TECHMOBILE] app to remember last selected option from dropdown query list.

    Posted 8 days ago

    The "My Schedule" application in TECHMOBILE includes a dropdown list that mobile users rely on to choose which query should be executed to retrieve the Work Order list from Maximo/MAS Manage.
    However, there's a limitation: the selected option resets to the default value ("Assigned work") whenever the user closes the app and reopens it. This behavior can be frustrating for users who frequently work with a specific query.
    To address this, I'm sharing a simple customization (suggested by IBM) that allows TECHMOBILE to remember the last selected dropdown option for each user.

    Please note: The last selected option is stored in local storage and if the user reinstalls aplication, or performs a "Reset App" action from the Settings section, the stored selection will be lost.

    Use Case:

    1.The user logs into the mobile application and navigates to the My Schedule app.

    2.The user selects a specific option from the dropdown list, for example, "My work order".

    3.The user closes the application and later logs in again.

    4.Instead of reverting to the out-of-the-box "Assigned work" default, the dropdown now displays the option selected in step #2 "My work order".

    Customisation:
    1. /TECHMOBILE/src/AppCustomizations.js
    import SchedulePageController from "./SchedulePageController.js";
    
    class AppCustomizations {
     applicationInitialized(page, app) {
       this.page = page;
       this.app = app;
     }
    
     async pageInitialized(page, app) {
        this.page = page;
        this.app = app;
    
        if(page && page.name === 'schedule') {
            let persistentDropdownVal = localStorage.getItem("cMyLastSelectedDropdown");
            if(persistentDropdownVal) {
                this.page.state.selectedDS = persistentDropdownVal;
                this.app.state.selectedWoListDs = persistentDropdownVal;
            }
        }
     }
    
     async changeDropdownSelection(evt) {
        let schedulePageController = this.page.findController(
            (c) =>  {
                if (c instanceof SchedulePageController) {
                    return true;
                }
            }
        );
        if(schedulePageController) {
            localStorage.setItem("cMyLastSelectedDropdown", evt.selectedItem.id);
            await schedulePageController.loadWOListData(evt);
        }
     }
    
    }
    
    export default AppCustomizations;

    2. /TECHMOBILE/src/app.xml (replace on-change="loadWOListData" to custom one on-change="changeDropdownSelection")

    (...)
    <dropdown 
     slot="dropdown" 
     background-color="white" 
     selected-item="{page.state.selectedDS}" 
     id="rzvz4" 
     on-change="changeDropdownSelection" 
     hide-unselected-placeholder="true">
    (...)


    ------------------------------
    Bartosz Marchewka
    IBM Maximo Consultant
    AFRY
    ------------------------------


  • 2.  RE: MAS Mobile - Enhancing the "My Schedule" [TECHMOBILE] app to remember last selected option from dropdown query list.

    Posted 5 days ago
    Edited by Andrzej Więcław 5 days ago

    Nice one Bartosz! 

    It can save end users some trouble.
    Just one note, to be more general - without your adjustment the state of the select drop-down gets always reset to whichever maximo-applcation/pages/page/maximo-datasource/maximo-datasource-override tag is set as default="true".

    Thanks for sharing!



    ------------------------------
    Andrzej Więcław
    Maximo Technical SME
    ZNAPZ B.V.
    Wrocław, Poland
    ------------------------------



  • 3.  RE: MAS Mobile - Enhancing the "My Schedule" [TECHMOBILE] app to remember last selected option from dropdown query list.

    Posted 5 days ago

    Hi Andrzej,

    I appreciate your interest in my post. Based on my experience if you would like to change out of the box behaviour for all of the users, so instead of showing "Assigned work" as default one set "My work order". You should change value in selectedDS state definition directly in app.xml.

    Before:

    <states id="nmvrw">
        (…)
        <state name="selectedDS" value="todaywoassignedDS" type="string" id="vewqj"/>
        (…)
    </states>
    

    After:

    <states id="nmvrw">
        (…)
        <state name="selectedDS" value="myWorkOrder" type="string" id="vewqj"/>
        (…)
    </states>
    

    It's because value from this state is later use in dropdown tag in selected-item

    <dropdown slot="dropdown" background-color="white" selected-item="{page.state.selectedDS}" id="rzvz4" on-change="loadWOListData" hide-unselected-placeholder="true">


    ------------------------------
    Bartosz Marchewka
    IBM Maximo Consultant
    AFRY
    ------------------------------



  • 4.  RE: MAS Mobile - Enhancing the "My Schedule" [TECHMOBILE] app to remember last selected option from dropdown query list.

    Posted 5 days ago

    Nice one Bartosz, but ideally it would be in the product for user to define a default, so I raised the IBM Idea - https://ideas.ibm.com/ideas/MASMOBILE-I-793

    Technician (RBA) - User should be able to define their default query which is used each time they log in to the app.

    Some customer sites will work on a different basis to using the standard query based on Assigned Work - My Work Order may be a better query for them. A user at the start of the day may need to work on - PMs due this week - as a priority over other assigned work, while others in the organization may work through the assigned work in the order given to them. There could be custom queries which the user may wish to be their default.
     
    The user should be able to set a default query for the Technician application which would be activated each time they log in to the application, but not when moving from a work order to the asset and then returning to the work order, it shouldn't be reset on that basis.



    ------------------------------
    Andrew Jeffery
    Maximo SME
    ZNAPZ b.v (a Naviam company)
    Barnstaple
    +44 (0)777 1847873
    ------------------------------



  • 5.  RE: MAS Mobile - Enhancing the "My Schedule" [TECHMOBILE] app to remember last selected option from dropdown query list.

    Posted 5 days ago

    Thank you @Andrew Jeffery for raising the IBM Idea.



    ------------------------------
    Bartosz Marchewka
    IBM Maximo Consultant
    AFRY
    ------------------------------