Wednesday, January 29, 2014

Show the Username and Default Insert Site in the Maximo header

To show the currently logged-in user and his Default Insert site in the header of the Maximo application 

When working in some Maximo applications (e.g. workorder and locations) in a multi-site environment the user must have the Default Insert site set to the site he wants to insert a new record for.

This information is displayed in Maximo through a menu, but the user will first have to open it. It would be nice to always show the user his Default Insert Site.

Show the Default Insert site of the user in the header of Maximo.

In the header there is room for some information, like shown in the picture below:

Step 1 - Locate the file

In order to show information in this part of Maximo we need to modify the titlebar.jsp

This file is located in \IBM\SMP\maximo\applications\maximo\maximouiweb\webmodule\webclient\components

This is regardless of what skin you use.

Make a copy of titlebar.jsp as a backup in this directory. 

Modify the titlebar.jsp

After the line  (line 20):

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

Enter the following lines:

String defSite= "";

  defSite= control.getWebClientSession().getUserInfo().getInsertSite();
  catch(Exception ex)

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;

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%>

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 startscreen. When opening the Workorders application for example you will see the second mention of the name is useful:


Thursday, January 16, 2014

Use UNC path as location for Attached Documents in Maximo 7.5

Use a network location (UNC Path) as Attached Documents location in Maximo on Windows Server 2012. 

When configuring a attached documents configuration Maximo needs a drive letter. This drive letter can be linked to a UNC path where the documents should be stored.

However, the mapping is not available when the user is logged off from the server after a reboot for example.

Create a Windows Service that will create a drive mapping. This way the drive is available when the server starts.

I did this on a Windows Server 2012 environment with Maximo

Step 1. Create a Windows Service that will map the UNC path to a drive letter.

I use the 'Non Sucking Service Manager' tool to create a service. Great name :) 

The service will execute a batch file which in return will first delete the network mapping and the create it again.

You can download the tool here:

Next i create a bat file in which the mapping is deleted and then created again.

net use e: /DELETE /YES


Fill in the appropriate values so it matches your environment. When I navigate to the FILESERVER01\Maximo\Test make sure there is a folder DOCLINKS7, you will see it in Step 2.

I save the bat file as autoexnt.bat, you could name it anyway you like.

Next, open a dosbox as an Administrator and navigate to the location of the nssm tool.

Then type:  nssm install Mapping
Note that 'Mapping'  is the name of the Service you can name it anyway you like. A dialog will open.

Now choose the created batch file in the Path option. You can also change the name of the service again here.

Now go to the Exit actions tab in the nssm tool and at the Restart dropdownbox, choose 'No action (srvany compatible)' This will prevent the service from keep trying to delete and make the mapping it it fails.

Click on the 'Install service' button to create the Service.

Open the Services.msc and check the Service. Make sure it is set to the 'Automatic' Startup Type

Next we open the IBM HTTP Server 7.0 Service ans set the Startup type to 'Automatic (Delayed Start)'

This is needed to make sure the Mapping service has created the mapping before the webserver that serves the Maximo documents is starting up. 

Now we have a mapping ready for us whenever the server is running and after a reboot the mapping will be created even if no user logs on to the server.

Step 2. Webserver configuration.

Now we need to configure Maximo to use the Mapping, this is standard Doclnks configuration, but i will post it here anyway, just to show you it works :)

I run a Notepad ++ as Administrator and navigate to D:\ibm\HTTPServer\conf. I open the httpd.conf file (make sure you create a backup first)

On line 221 modify the DocumentRoot like so:

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#DocumentRoot "D:/IBM/HTTPServer/htdocs"
DocumentRoot "E:\DOCLINKS7"

on line 249 modify the Directory like so:
# This should be changed to whatever you set DocumentRoot to.
#<Directory "D:/IBM/HTTPServer/htdocs">
<Directory "E:\DOCLINKS7">

Here is an overview of the file:

Save the httpd.conf and close the Notepad ++

Step 3. Configure Maximo.

Like in step 2 this is also standard Maximo Doclinks configuration.

I modify the following properties in the System Properties:

mxe.doclink.doctypes.defpath  ->  E:\DOCLINKS7
mxe.doclink.doctypes.topLevelPaths  ->  E:\DOCLINKS7

and the following property:

mxe.doclink.path01  ->  E<PATH>\DOCLINKS7 = http://MaximoServerName/

where the MaximoServerName if the name of your Maximo server.

You can also set the mxe.doclink.path01 in the file, this can be nice when rolling back databases.
That would look like this:

And finally you set the Folders in each application that uses Attached Documents in Maximo.

Step 4. Completing.

Now rebuild and redeploy Maximo.

When finished, reboot the server completely to test everything.

When logged on on the server you will see the drive as a 'Disconnected Network Drive' 
This is normal, and when you click on it, it should show the content of the folder.

So there you have it, a UNC path as a Doclinks location.