Search This Blog

Thursday, March 27, 2014

Maximo 7.5 - Use button with Automation Script

Example:
A button on the Work Order Tracking application that triggers a script. The script will read the Target Start Date from the Work Order, add the Duration to it and will automatically fill in the Target Finish Date.

How to:
Open the Automation Scripts application.  Create a new ‘Script with Action Launch Point’
Fill in the name of the Launch Point, the Object and the Name of the Action. 

We will see this Actionname later when we configure the button and an Action with this name will automatically be created. We choose to use a New script. Click [Next] to continue

Next give the New Script a name and description. I use jython as the script language. We will add variabeles later on, so leave them for now and click [Next] to continue.

We need to fill in the script here. As we cannot test it here we will fill in a ‘1’ (cannot leave it blank for some reason) We will return later to add the correct script. Click the [Create] button


Open the script and go to the ‘Variables’ tab.

Add the following variables by pressing the [New Row] button

Variable:             TARGSTART_IN
Description:       Target Start Date            
Variable Type:   IN
Override:            Checked
Binding Type:    Attribute

Variable:             ESTDUR_IN
Description:       Estimated Duration        
Variable Type:   IN
Override:            Checked
Binding Type:    Attribute

Variable:             TARGFINISH_OUT
Description:       Target Finish Date          
Variable Type:   OUT
Override:            Checked
Binding Type:    Attribute



Click the ‘Save’ icon at the top of the screen and go to the ‘Launch Points’ tab. Click on the ‘Edit Launch Point Detail’ button.

In this screen we bind the created variables to Attributes. This can be done per Launch point. So if you create multiple launch points you can use the same variables but bind them to different Attributes.

Open the Details of the attribute and click on the ‘Select Attribute Name’ button.

Check the Action application to see the configuration of the Action that was created.

Do not change anything here, this is configured by creating the launch point, we will just check it here.

Next we will add the button to the screen. Open the Application Designer en open the WOTRACK application.

Add a Signature Option to the WOTRACK application by going to the ‘Select Action’ menu and clicking on ‘Add/Modify Signature Options’



Create a new Signature with the same name as the Action.

Open the ‘Advanced Signature Options’ at the bottom of the dialog and make sure that “This is an action that must be invoked by use in the UI”  is selected.



Click [OK] and Save the ‘WOTRACK’ application.
Now we add a ‘Pushbutton’ to the Work Order tab. Just somewhere near the Target Start and Target Finish Date fields.




Open the properties of the Pushbutton. Give the Pushbutton a label and enter the Signature name as Event.
Save the WOTRACK application.
Now we need to give rights to the authorized groups on the button. Open the Security Groups application. Open the MAXADMIN group, go to the ‘Applications’ tab and filter for the ‘Work Order Tracking’ application.

Next filter or search for the Signature option we created and check the ‘Grant Access?’ option.
Save the group.


Now we need to create the actual script. Go to the ‘Automation Scripting’ application. Open the script we created earlier.

We will replace the current code with the code below;

from java.util import Date
TARGFINISH_OUT = Date(TARGSTART_IN.getTime() + long(ESTDUR_IN * 60 * 60 *1000))
In short the code does the following;
Coverting the TargetStartDate to milliseconds, converting the estimated Duration to milliseconds and adding them up, converting the total of milliseconds to a date and storing that in the Target Finish Data.

Click the ‘Save’ button, and to test the script, click the ‘Run’ button.
Result of the ‘Run’ button;

This isn’t telling us much as the variabele is empty, so the calculation is not working…

To properly test the configuration, we will go to the Workorder Tracking application, and actually push the button.



Push the button, and the date will be calculated.

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 7.5.0.5 application 


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.

Solution:
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= "";

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) :

     
<%=apptitle%>
   


Enter the following code after the code found above:

     
        User:        <%=userFullName%>    
        Insert Site: <%=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:

Tuesday, March 18, 2014

Deleting non-processed messages from queues – MIF (Maximo Integration Framework)


Queues
The IBM Maximo uses these queues for data integration purposes:
Inbound sequential (sqin) - Maximo sequential queue used for importing data
Inbound continuous (cqin) – Maximo continuous queue used for importing data
Outbound sequential (sqout) – Maximo sequential queue used for exporting data
Error continuous (cqinerr) – Maximo continuous queue used for error. The error messages generated in the inbound continuous queue (cqin) can be redirected to this queue, since the cqinerr has been previously set for receiving those messages
Queues are structures based on the FIFO (first in, first out) principle, in which the first elements included in the queue are the first elements to be removed. In a sequential queue, whenever an error occurs, this queue stops processing its elements and remains in the same position until the message is removed or the error is fixed. On the other hand, in a continuous queue, even if there is an error, this queue moves on processing all the other elements.
Clients using sequential queues usually have to delete all the messages of a certain queue during the data integration. We will use an inbound operation with XML as an example to explain this process:
From an MIF environment correctly set, import the XML file. MIF then identifies the JMS inbound queue and writes the message into this queue. If the message contains multiple instances of a document, MIF will write multiple messages into the queue. If at least one of these messages is processed with errors, an exception message is identified and no other message is processed and written into the database.
You can also import several records by using several XML files or records in an XML file, and this action generates several messages in the queue. If, by any chance, a failure occurs while importing the records, you can delete or fix the XML that generated the error in the Message Reprocessing application (see the picture below). With this procedure, the following message in the queue is processed. However, if the entire batch of messages contains errors, you do not need to wait until all the messages are processed, deleted or fixed; you can use IBM Maximo or the application server (Weblogic or Websphere) in order to delete all the elements from the queue. Then, you can perform the required modifications and import news message to an empty queue.


  



To use Maximo for deleting the queues, follow these steps:
Go to Integration > External Systems.
Select the external system used for integration purposes. Then, go to Select Action > Add/Modify Queues.
Select the queue that contains non-processed data and click the Delete Queue Data button.
In case you need to check how many messages there are in the queue, click the View Queue Data button:



  Click OK. If you do not provide any parameters, all the messages will be deleted:






  You will see a message informing how many messages were deleted:
image
  
Using Weblogic for deleting the queues:  follow the steps below:
Go to JMS > JMS Modules > intjmsmodule > sqin > Summary of JMS Messages > sqin
Then, click the Monitoring tab:
image



Select intjmsmodule!sqin and click Show Messages
image
 Select Delete All to delete all the messages:
image
 Check that all the listed messages have been deleted:

image
image
image
image











Using WebSphere for deleting the queues: follow the steps below:
Go to Buses > intjmsbus > destination > sqinbd > Queue points
Select the sqin target and click Runtime. Then, click Messages
image





  Click the Delete All button:

Confirm that all messages must be deleted by clicking OK:

image










imageimageimageimageimageimageimageimageimage


  Check that all non-processed messages have been deleted from the queue:




image
image
image
imageimage

Deploying the confhelp.properties file in CCMDB




The confhelp.properties file must be deployed to enable the help system for the product.
To deploy the confhelp.properties file, complete the following steps:
  1. Ensure that you are logged in to the administrative workstation.
  2. Run the following command:
3.  \jacl\solutions\Sendfile.bat
4. 
5. 
6.  $
7.  "\applications\
8.  maximohelp\helpweb\webmodule\WEB-INF\confhelp.properties"
9.  "WASInstallLocation>\properties"
"confhelp.properties"

MAS and Manage custom resources are not reconciled

  After a change was applied to IBM Maximo Application Suite (MAS) or IBM Maximo Manage, the custom resources are not reconciled. For exampl...