Monday, August 4, 2014

Hyperlink to explorer with variable

Goal:
Create a link in Maximo to a file stored on a network drive. 

Example:
I want to create a link to a folder or a file from a Maximo screen. When the user clicks on the link the file should open with the on the user his device configured application.
When it is a folder, the folder should open in explorer.

The link should be dynamic and be build up from a static part and a variable part.

Solution:

I use a Windows 2012 server with Maximo 7.5.0.5 on a Oracle 11g Database in this example.


Note: This solution will only work on devices with a explorer.exe. So I gues only Windows based machines.

First I will create an extra field on the workorder application named GNZ_FILETEST with the following properties.



Save, Turn the Admin mode on, and then Apply the Configuration changes




When the configuration is done, turn off the admin mode and open the Application Designer. In the Application Designer, open the WOTRACK application as I will display this field on the workorder screen.

On the Main tab of the workorder screen I will add an textbox and a just below the textbox a Hyperlink.


Set the following properties for the textbox:
 - Attribute: GNZ_FILETEST




The for the hyperlink control, I set the following properties:

 - Label: Open Folder or File
 - Event Type:  launchexternal
 - Event Value: explorer.exe e:\\{GNZ_FILETEST}



I Use a local file path in order to test this, I will add the code for a link to a network drive further below in this post.

Save the application and open the Work Order Tracking application in Maximo.

Open an existing Workorder or create a new one. On the workorder tab you will now see the following:



In order to test this I will fill in 'DataPump' in the new text field, save the records and the click on the hyperlink.




Hmmmm nothing happens...


Let's see what's wrong.

I found this page online:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014176148

They mention: You may have to change the Activex settings in the Intranet zone to enable ""ActiveX Controls not marked as safe"

So I go and check that setting. I run Internet Explorer 10 in this example, so it may look different for you when you are using an other browser.

I go to Internet Options -> Security Tab, and for the 'Trusted Sites' (where my Maximo website is part of) I click on the 'Custom level' button




Then I scroll down to 'Initialize and script ActiveX controls not marked as safe for scripting'
There I set the radiobutton from disable to enable.




Click [OK] and then [Apply] and the [OK] again to close the Internet Options.

Now I close my browser and open it again and login to Maximo to go to the Work Order Tracking application. There I open the workorder again and click the link.

And now the explorer opens in the e:\DataPump folder :)


Afbeelding 11

You can choose not to use the variable GNZ_FILETEST, but I used it in this example so you could use if to make it more dynamic.

There are now some variations you can do in the Event Value.
Some options:

Connect to a network drive:
explorer.exe \\\\filesvr01\\Shared_folder_Name\\{GNZ_FILETEST}
Mind the double slashes here!

Open a file from a network drive, where the filename is specified in the textfield and the filetype is fixed:
explorer.exe \\\\filesvr01\\Shared_folder_Name\\{GNZ_FILETEST}.pdf

The explorer will take care of opening the default set pdf reader on the desktop. 

GNZ.