Maximo

Maximo

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

 View Only
  • 1.  Need help with creating a new sliding drawer

    Posted Tue October 31, 2023 03:27 PM
    Edited by Ritesh Ranjan Tue October 31, 2023 03:28 PM

    Hi Team,

    I need to create a sliding drawer. I Tried to replicate the WORKORDER SPECIFICATIONS sliding drawer scenarios in TECHMOBILE app.

    I duplicated all the necessary sections of WORKORDER SPECIFICATIONs and renamed all the labels wherever necessary. It worked fine with duplicated codes in XML and it was also opening SPECIFICATION sliding drawer.

    Now I need to show asset user and custodian so changed the necessary details in necessary places, but then sliding drawer was not even coming up.

    Can someone advice if anyone has created a custom sliding drawer?

    Also is sliding drawer allowed to use outside of controller file?



    ------------------------------
    Ritesh Ranjan
    Tech Lead (Wipro)
    ------------------------------



  • 2.  RE: Need help with creating a new sliding drawer

    Posted Wed November 01, 2023 11:09 AM

    Can someone please advise on this?

    Thanks in Advance.



    ------------------------------
    Ritesh Ranjan
    Tech Lead (Wipro)
    ------------------------------



  • 3.  RE: Need help with creating a new sliding drawer

    Posted Thu November 02, 2023 02:21 PM

    Hi Ritesh

    I hope proof-of-concept that I created for you will help to move forward. Please find the result below with full customisation.

    Customisations:
    Prerequisites: 
    Create new relationship on Maximo/Manage side.
    Object: WORKORDER
    Relationship: C_ASSETUSERCUST
    Child Object: ASSETUSERCUST
    Where Clause: assetnum = :assetnum and siteid = :siteid
    Maximo Mobile changes:
    1. AppCustomizations.js
    class AppCustomizations {
       applicationInitialized(page, app) {
         this.app = app;
         this.page = page;
       }
    
      /**
       * Open Users and Custodians Drawer.
       */
      async showAssetUserCustodiansDrawer() { 
        const assetUser = this.page.currentPage.datasources['cAssetUserCustodiansDS'];
        await assetUser.load({ noCache: true});
        //istanbul ignore next
        this.page.showDialog('cAssetUserCustodiansDrawer');
      }
      
     }
    
     export default AppCustomizations;
    2. app.xml
    a) maximo-datasource
    <maximo-datasource id="cAssetUserCustodiansDS" order-by="personid" relationship="C_ASSETUSERCUST" selection-mode="none" depends-on="woDetailResource" notify-when-parent-loads="true" cache-expiry-ms="1">
        <schema id="cAssetUserCustodiansDSSchema">
            <attribute name="personid" id="cAssetUserCustodiansDSPersonId"/>
            <attribute name="isuser" id="cAssetUserCustodiansDSUser"/>
            <attribute name="iscustodian" id="cAssetUserCustodiansDSCustodian"/>
        </schema>
    </maximo-datasource>
    b) slading-drawer
    <sliding-drawer id="cAssetUserCustodiansDrawer" content-padding="false" align="start" header-text="Users and Custodians">
              <panel id="cAssetUserCustodiansDrawerPanel">
                <box padding-top="1" id="cAssetUserCustodiansDrawerBox"/>
                <data-list datasource="cAssetUserCustodiansDS" show-search="false" id="cAssetUserCustodiansDrawerDataList">
                  <border-layout padding="false" slot="item" fill-parent="true" id="cAssetUserCustodiansDrawerLayout">
                    <start width="70" horizontal-overflow="hidden" id="cAssetUserCustodiansDrawerTopStart">
                      <field value="{item.personid}" override-required="true" field-class-name="16-bold" padding="none" hide-label="true" id="cAssetUserCustodiansDrawerTopStartBorderLayoutField"/>
                      <field value="User {item.isuser}" override-required="true" field-class-name="16-bold" padding="none" hide-label="true" id="cAssetUserCustodiansDrawerTopStartBorderLayoutIsUserField"/>
                      <field value="Custodian {item.iscustodian}" override-required="true" field-class-name="16-bold" padding="none" hide-label="true" id="cAssetUserCustodiansDrawerTopStartBorderLayoutIsCustodianField"/>
                    </start>
                  </border-layout>
                </data-list>
              </panel>
    </sliding-drawer>

    c) navigation-title

    <navigator-tile tile-label="Users and Custodians" pictogram="maximo:services" onclick-action="showAssetUserCustodiansDrawer" hidden="{cAssetUserCustodiansDS.items.length === 0}" id="cAssetUserCustodiansNavigator"/>

    Please remember that it was only PoC and there are some areas that could be improve for final solution:

    • fields in sliding drawer (layout + show Y/N in better way)
    • maybe you don't need to create new custom relationship but instead use nesting relationship definition in maximo-datasource

    Good luck!



    ------------------------------
    Bartosz Marchewka
    ------------------------------