Maximo Anywhere

  • 1.  How to determine what URL user is connected to?

    Posted Mon March 29, 2021 01:17 PM
    Anywhere Work Technician 7.6.4:

    Is there a way to determine what URL a user is connected to from within the Anywhere WT app?

    Thanks.


  • 2.  RE: How to determine what URL user is connected to?

    Posted Thu April 01, 2021 10:22 AM
    i wonder if you can find where the Help > About screen is stored in the Anywhere build files that you can add it into there

    Usually I change the applicationname within the app.xml so that I know which environment its connected to upon the login screen

    ------------------------------
    Christopher Kung
    ------------------------------



  • 3.  RE: How to determine what URL user is connected to?

    Posted Fri April 02, 2021 11:37 AM
    The method Christopher has explained is the way I do it as well. Note that, just like backflow of Maximo, when you promote your development work to upper environments, remember to update the application name otherwise you will be looking at "Work Execution Dev" when its really pointing to PROD.

    ------------------------------
    Aki Porter
    ------------------------------



  • 4.  RE: How to determine what URL user is connected to?

    Posted Tue April 06, 2021 05:02 AM
    Hello, you can also do this: localStorage.getItem('maximo_url') anywhere in the app and show it in a local attribute or add a resolver function to show it..

    Best Regards

    ------------------------------
    Robi Cavnik
    Troia d.o.o.
    ------------------------------



  • 5.  RE: How to determine what URL user is connected to?

    Posted Sat May 22, 2021 02:45 AM
    Edited by User1971 Sat May 22, 2021 02:46 AM

    @Christopher Kung and @Aki Porter

    Here's a related post might interest you: Indicate what user is currently signed in to Anywhere?
    Maybe the hostname / URL could be added to the solution in that post? Could we use the technique that @Robi Cavnik mentioned? localStorage.getItem('maximo_url')

    I don't have much experience with customizing Anywhere. So that's just a shot in the dark.

    Cheers.​​​​



  • 6.  RE: How to determine what URL user is connected to?

    Posted Thu May 27, 2021 09:33 PM
    Hi Robi. 
    A colleague says he noticed the localStorage.getItem('maximo_url') is empty when used in the Anywhere WT XML/view.
    Do you have any idea why it would be empty?

    Thanks.


  • 7.  RE: How to determine what URL user is connected to?

    Posted Fri June 04, 2021 12:54 PM
    Edited by User1971 Sat September 11, 2021 02:42 PM
    This solution worked for us. It allows us to see what user is logged in --and-- what Maximo environment Anywhere is connected to.

    (I wasn't the one who implemented it, so the end solution might have varied slightly.)


    1. Stop Maximo Anywhere server.

    2. Open MobileFirstStudio eclipse to modify the xml of Technician (Work Execution) application UI. Eclipse will build the app after changes.

    3. Go to this path in project in eclipse:
    MximoAnywhewre->apps->WorkExecution->artifcat->app.xml

    4. Comment out/remove previously provided <view> tag. (i.e. <view id="WorkExecution.UserInfoView" label="Logged-In User".....)

    5. Add new 'view' to display the current logged user along with environment name.
    - Search for <ui id="ui">
    - There will be multiple <view> tags, which display different sections in UI.
    - To display logged in user & env, we will add new view.

    6. Add below view code after <ui> tag
    <view id="WorkExecution.UserInfoView" label="User-Env Details">
    <requiredResources id="WorkExecution.userInfoView_requiredResources">
    <requiredResource id="WorkExecution.userInfoView_userInfo" name="userInfo"/>
    <requiredResource id="WorkExecution.userInfoView_userInfo_1" name="oslcmaxvars1"/>
    </requiredResources>
    <container id="WorkExecution.UserInfoView_userInfo_container_0" resource="userInfo">
    <group id="WorkExecution.UserInfoView_group_0">
    <groupitem id="WorkExecution.UserInfoView_userInfo_groupitem_WorkExecution.LoggedinuserView">
    <text id="WorkExecution.UserInfoView_userInfo_groupitem_0_loggedinuser" resourceAttribute="loginid" label="User" editable="false" placeHolder="Tap to enter"/>
    </groupitem>
    </group>
    </container>
    <container id="WorkExecution.UserInfoView_userInfo_container_1" resource="oslcmaxvars1">
    <group id="WorkExecution.UserInfoView_group_1">
    <groupitem id="WorkExecution.UserInfoView_userInfo_groupitem_WorkExecution.LoggedinuserView_1">
    <text id="WorkExecution.UserInfoView_userInfo_groupitem_0_loggedinuser_1" resourceAttribute="varvalue" label="Environment" editable="false" placeHolder="Tap to enter"/>
    </groupitem>
    </group>
    </container>
    </view>

    7. Add below 'resource' tag to fetch environment value from maxvars. (We will be doing one record insert in MAXVARS table for environment name)
    - Search for <data id="data">
    - There will be multiple <resource> tags.
    - Add below code after <ui> tag.

    <resource describedBy="http://[your maximo url]#MaxVars" id="oslcmaxvars1" isSystem="true" name="oslcmaxvars1" pageSize="200" providedBy="/oslc/sp/[your path]" refreshOnLogin="true">
    <attributes id="oslcmaxvars1_attributes">
    <!-- limits the scope of attributes used from full Work Order RDF -->
    <attribute describedByProperty="spi:varname" id="oslcmaxvars1_varname_spivarname" index="true" name="varname"/>
    <attribute describedByProperty="spi:varvalue" id="oslcmaxvars1_varvalue_spivarvalue" name="varvalue"/>
    <attribute describedByProperty="spi:orgid" id="oslcmaxvars1_orgid_spiorgid" name="orgid"/>
    <attribute describedByProperty="dcterms:identifier" id="oslcmaxvars1_identifier_dctermsidentifier" name="identifier"/>
    </attributes>
    <queryBases id="oslcmaxvars1_queryBases">
    <queryBase id="oslcmaxvars1_queryBase_getmaxvarsinprglabtrans" name="getMaximoEnv" queryUri="/oslc/os/oslcmaxvars"/>
    </queryBases>
    <whereClause clause="spi:varname in ['MAXIMO_ENV']" id="oslcmaxvars1_whereClause"/>
    </resource>


    8. Make new var entry in MAXVARS table. Run below sql scripts. (Attribute 'VARVALUE' to be provided as per environment i.e. DEV/TEST/PROD)

    REM INSERTING into MAXVARS
    SET DEFINE OFF;
    Insert into MAXVARS (VARNAME,VARVALUE,ORGID,SITEID,MAXVARSID,VARTYPE) values ('MAXIMO_ENV','DEV',null,null,maxvarsseq.nextval,'SYSTEM');
    commit;

    9. Save the xml.

    10. Start the server.

    1. Stop Maximo Anywhere server.
    
    2. Open MobileFirstStudio eclipse to modify the xml of Technician (Work Execution) application UI. Eclipse will build the app after changes.
    
    3. Go to this path in project in eclipse: 
           MximoAnywhewre->apps->WorkExecution->artifcat->app.xml
    
    4. Comment out/remove previously provided <view> tag. (i.e. <view id="WorkExecution.UserInfoView" label="Logged-In User".....)
    
    5. Add new 'view' to display the current logged user along with environment name.
           - Search for <ui id="ui">
           - There will be multiple <view> tags, which display different sections in UI.
           - To display logged in user & env, we will add new view.
    
    6. Add below view code after <ui> tag  
                  <view id="WorkExecution.UserInfoView" label="User-Env Details">
                   <requiredResources id="WorkExecution.userInfoView_requiredResources">
                        <requiredResource id="WorkExecution.userInfoView_userInfo" name="userInfo"/>
                        <requiredResource id="WorkExecution.userInfoView_userInfo_1" name="oslcmaxvars1"/>
                   </requiredResources>
                         <container id="WorkExecution.UserInfoView_userInfo_container_0" resource="userInfo">
                               <group id="WorkExecution.UserInfoView_group_0">
                                      <groupitem id="WorkExecution.UserInfoView_userInfo_groupitem_WorkExecution.LoggedinuserView">
                                          <text id="WorkExecution.UserInfoView_userInfo_groupitem_0_loggedinuser" resourceAttribute="loginid" label="User" editable="false" placeHolder="Tap to enter"/>
                                      </groupitem>                            
                               </group>
                         </container>
                         <container id="WorkExecution.UserInfoView_userInfo_container_1" resource="oslcmaxvars1">
                               <group id="WorkExecution.UserInfoView_group_1">
                                      <groupitem id="WorkExecution.UserInfoView_userInfo_groupitem_WorkExecution.LoggedinuserView_1">
                                          <text id="WorkExecution.UserInfoView_userInfo_groupitem_0_loggedinuser_1" resourceAttribute="varvalue" label="Environment" editable="false" placeHolder="Tap to enter"/>
                                      </groupitem>                            
                               </group>
                         </container>
                  </view>
    
    7. Add below 'resource' tag to fetch environment value from maxvars. (We will be doing one record insert in MAXVARS table for environment name)
           - Search for <data id="data">
           - There will be multiple <resource> tags.
           - Add below code after <ui> tag.
    
                  <resource describedBy="http://[your maximo url]#MaxVars" id="oslcmaxvars1" isSystem="true" name="oslcmaxvars1" pageSize="200" providedBy="/oslc/sp/[your path]" refreshOnLogin="true">
                         <attributes id="oslcmaxvars1_attributes">
                               <!-- limits the scope of attributes used from full Work Order RDF -->
                               <attribute describedByProperty="spi:varname" id="oslcmaxvars1_varname_spivarname" index="true" name="varname"/>
                               <attribute describedByProperty="spi:varvalue" id="oslcmaxvars1_varvalue_spivarvalue" name="varvalue"/>
                               <attribute describedByProperty="spi:orgid" id="oslcmaxvars1_orgid_spiorgid" name="orgid"/>
                               <attribute describedByProperty="dcterms:identifier" id="oslcmaxvars1_identifier_dctermsidentifier" name="identifier"/>
                         </attributes>
                         <queryBases id="oslcmaxvars1_queryBases">
                               <queryBase id="oslcmaxvars1_queryBase_getmaxvarsinprglabtrans" name="getMaximoEnv" queryUri="/oslc/os/oslcmaxvars"/>
                        </queryBases>              
                         <whereClause clause="spi:varname in ['MAXIMO_ENV']" id="oslcmaxvars1_whereClause"/>
                  </resource>
    
    
    8. Make new var entry in MAXVARS table. Run below sql scripts. (Attribute 'VARVALUE' to be provided as per environment i.e. DEV/TEST/PROD)
    
           REM INSERTING into MAXVARS
           SET DEFINE OFF;
           Insert into MAXVARS (VARNAME,VARVALUE,ORGID,SITEID,MAXVARSID,VARTYPE) values ('MAXIMO_ENV','DEV',null,null,maxvarsseq.nextval,'SYSTEM');
           commit;
    
    9. Save the xml.
    
    10. Start the server.