Pages

Saturday, February 1, 2020

Show the Username and Default Insert Site in the Maximo header

Goal: 
To show the logged-in user information such as name and default insert site in the header of the Maximo 7.5.x application.

Problem:
When working in multi site environment the user must have the Default Insert site set to the site he wants to create a new record for some site level Maximo applications (e.g. assets, location, workorder etc.).

User can find this information through a menu, It would good and reduce time if this information is displayed in the header always.

Solution:

Step 1 - Locate the file (titlebar.jsp)

We need to modify titelbar.jsp

We can find this file in the below path

\IBM\SMP\maximo\applications\maximo\maximouiweb\webmodule\webclient\components

Note: Make a copy of this file (just in case something goes wrong)

Modify the titlebar.jsp

String userFullName = control.getWebClientSession().getUserInfo().getDisplayName();

Enter the following lines:

String defSite= "";

try
{
  defSite= control.getWebClientSession().getUserInfo().getInsertSite();
}
  catch(Exception ex)
{
  defSite="Unknown";
}


In essention I create a variable that is empty. I try to get the user his InsertSite and put that in the variable. If no InsertSite exists I fill the variable with the text "Unknown"

Here a picture of the first change:




Then find the following block of code(original line number 130) :

<td style="vertical-align:<%if(useHomeButton){%>middle<%}else{%>top<%}%>;white-space: nowrap;">
    <span id="txtappname" class="<%if(useHomeButton)%>homeButton<%}%>txtappname">&nbsp;
<%=apptitle%>
    </span>
</td>


Enter the following code after the code found above:

<td width="290"nowrap style="vertical-align:top" align="right">
    <span class="txtappname">&nbsp;
        <font color="C0C0C0">User:        </font><%=userFullName%> &nbsp; &nbsp;
        <font color="C0C0C0">Insert Site: </font><%=defSite%>
    </span>
</td>

Here I add the code to set the new variable on the screen, I also show the userFullName variable here in order to show the user his full name.

Here is a picture of the modification:




Next rebuild the maximo.ear and redeploy the Maximo application.
After loggin in to Maximo you should see the username and default insert site in the header. Could be that your browser has cached some headerinformation, always try a hard refresh (CTRL + F5) if nothing shows up.

It should end up looking like this (I changed the name for privacy reasons):



It looks like itis show twice, but that is only on the start screen. When opening the Workorders application for example you will see the second mention of the name is useful:



No comments:

Post a Comment