Automatically refresh StartCenter

Users that heavily rely on StartCenters to check for incoming tickets or work orders sometimes ask if the StartCenter can automatically refresh itself.

To accomplish this you can inject a small JavaScript into the StartCenter JSP code.
Backup [SMPDIR]\maximo\applications\maximo\maximouiweb\webmodule\webclient\components\startcenter-options.jsp file and open it with a text editor.
Search for a row like this

<table ...

Add the following code just before that row.

<!-- BEGIN StartCenter automatic refresh -->
<script type="text/javascript">
  setTimeout("location.reload(true)", 60000);
</script>
<!-- END StartCenter automatic refresh -->

The refresh time in the previous script is in milliseconds so 60000 means 1 minute.

Rebuild and redeploy Maximo EAR file.

Now your start center will be automatically refreshed every 2 minutes.

Maximo 7.5 has introduced an exit warning so you may be prompted with a warning like this every minute.


To avoid this you can disable the exit warning as described in this TechNote.

Be careful when deciding how to set the refresh interval because setting it too low may impact overall system performances.

If this technique is not working you could look at this thread.

Enable autorefresh for one user group

A fellow Maximo consultant has applied this technique only to one user group using the following code.

<%@ page import="psdi.webclient.beans.startcntr.*" %>
<% 

try 
{
  SessionContext sessionContext = new SessionContext(wcs);
  StartCenterAppBean startcenter = (StartCenterAppBean)sessionContext.getCurrentApp().getAppBean();
  psdi.mbo.MboRemote mbo = startcenter.getMbo();
  String where = "groupname = '[GROUPNAME]' and userid in (select userid from maxuser where personid = '" + mbo.getUserInfo().getPersonId() + "')";
  psdi.mbo.MboSetRemote groups = mbo.getMboSet("$GROUPUSER", "GROUPUSER", where);
  groups.moveFirst(); 

  if ( !groups.isEmpty() ) 
  {
%>
    <script type="text/javascript"> setTimeout('window.location=window.location' ,10000); </script>
<% 
  } 
} 

catch (Exception e) 
{
  e.printStackTrace(); 
}
%>

The [GROUPNAME] must be replaced with the security group for which you want to enable the start center autorefresh.

Update
JedrekWiehas suggested to modify the script to set the session id in order to avoid duplication os user's sessions.

String refreshUrl = wcs.getMaximoRequestURI()
                  + "?event=loadapp&value=startcntr&"
                  + wcs.getUISessionUrlParameter()
                  + wcs.getCSRFTokenParameter();
%>
<script type="text/javascript"> setTimeout('window.location=window.location' ,10000); </script>
<% 



Labels: ,