Tuesday, August 5, 2014

Display user's "Default Insert Site" on maximo title bar


Hello,

Here I come with an interesting post on Maximo customization.

Problem
-----------
Display logged in user's "Default insert site" on the maximo header bar.


Solution
-----------
Follow the steps below, this solution is tested on Maximo 7.5. You need to modify the code according to the Maximo version you are working on.

  1. Navigate to path IBM\SMP\maximo\applications\maximo\maximouiweb\webmodule\webclient\components on you application server
  2. Search for file titlebar.jsp
  3. Open file and locate code below.
  4. <span id="txtappname" class="<%if(useHomeButton){%>homeButton<%}%>txtappname">&nbsp;  <%=apptitle%>
                                    </span>
  5. Below the above code and under the same <td> tag. Paste the code below
  6.     <%
               String site = "ERROR";
               String user = "TEMP";
                                       
               MboSetRemote sessionSet = control.getWebClientSession().getMXSession().getMboSet("MAXSESSION");
                sessionSet.setWhere(" MAXSESSIONUID = "+control.getWebClientSession().getMXSession().getUserInfo().getMaxSessionID()+" ");
                sessionSet.reset();
                                       
                if (sessionSet.getMbo(0) != null){
                         user = sessionSet.getMbo(0).getString("USERID");
                                           
                         // Get current insert site of user logged in
                         MboSetRemote userSet = control.getWebClientSession().getMXSession().getMboSet("MAXUSER");
                         userSet.setWhere(" userid ='"+user+"' ");
                         userSet.reset();
                                           
                         if (userSet.getMbo(0) != null){
                               site = userSet.getMbo(0).getString("DEFSITE");
                         }
                   userSet.close();
          }
                                       
          sessionSet.close();
      %>
       <font face="Arial" color="Yellow" size="4">
     &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <B>Site :</B>  <%=site%>
       </font>
  7. You are done.
  8. Difficulties to implement, write to me. I will be happy to help :-)

No comments:

Post a Comment