Tracking changes using Audit feature

A common requirement in Maximo is to track changes made by users on a specific object (database table). In Maximo terms this is called ‘Audit Tracking’.
In this post I will describe how to enable audit tracking for a specific set of attributes of an object and how to display the updates in a separate tab of the corresponding application.
I will use the Assets application for this tutorial and here is the final outcome I have achieved.

There are three configurations to be implemented for this:

  1. Enable audit of the main object and select attributes to be audited
  2. Define relationship to the audit table
  3. Customize the application to display the audit log from the UI

Enable audit

First step is to enable the auditing of the table you want to monitor.
Open the Database Configuration application, select ASSET object and check the Audit Enabled flag.

You now have to select which fields will trigger the audit record. Switch to the Attributes tab and select the Enable Auditing flag for STATUS, SERIALNUM, LOCATION, DESCRIPTION fields.

Enable admin mode, apply configuration changes and disable admin mode.
A new database table A_ASSET will be created and, from now on, all the changes to the audited fields will be traced in the audit table.

Define relationship

In order to be able to display the audit records we have to create a relationship from the ASSET table to the A_ASSET table.
Open the Database Configuration application, select ASSET object and in the Relationships tab create the following relationship.

  • Relationship: A_ASSET
  • Child Object: A_ASSET
  • Where Clause: assetnum=:assetnum and siteid=:siteid

Customize application

Now you can use the relationship you have just created to display records from the child A_ASSET audit table in the Asset application.
Open Application Designer application, select the ASSET application and export the app’s XML definition.
Backup the file and edit it with a text editor. Paste the text below before the last </tabgroup> before the </clientarea> tag.

<tab id="myhist" label="History">
<section id="myhist_grid1">
<sectionrow id="myhist_grid1_11">
<sectioncol id="myhist_grid1_11_1">
<section id="myhist_grid1_11_1_1">
<multiparttextbox dataattribute="assetnum" descdataattribute="description" id="myhist_grid1_1"/>
</section>
</sectioncol>
</sectionrow>
</section>
<table id="myhist_t1" inputmode="readonly" label="Asset history" orderby="EAUDITTIMESTAMP desc" relationship="A_ASSET">
<tablebody displayrowsperpage="10" id="myhist_t1_tb">
<tablecol dataattribute="SERIALNUM" id="myhist_t1_SERIALNUM"/>
<tablecol dataattribute="STATUS" id="myhist_t1_STATUS"/>
<tablecol dataattribute="LOCATION" id="myhist_t1_LOCATION"/>
<tablecol dataattribute="DESCRIPTION" id="myhist_t1_DESCRIPTION"/>
<tablecol dataattribute="EAUDITUSERNAME" id="myhist_t1_EAUDITUSERNAME" label="Changed By"/>
<tablecol dataattribute="EAUDITTIMESTAMP" id="myhist_t1_EAUDITTIMESTAMP" label="Changed Date"/>
</tablebody>
</table>
</tab>
</tabgroup>
...
</clientarea>
Tracking changes using Audit feature

6 thoughts on “Tracking changes using Audit feature

  1. Nice post Bruno , as usual.
    I have a request , if you can give some light on how to create custom control and how the components of the control are related ( jsp , component class,control class).
    how to refrence the MBO in the JSP file.
    That would be really helpful
    Thanks

  2. Hi Bruno ,

    Need little help…I wanted to monitor all active crons within maximo and get notification when any cron not started/run as per schedule , failed after start , successfully completed…
    can you please guide how this can be achieved

  3. Thank you for the good instructions. I was able to create a History tab for PM module to track Frequency and FreqUnit changes as requested by one of our managers.

  4. An audit is necessary in order to find those mistakes that were made and correct them for normal functioning.

  5. You should be aware that the solution provided by Bruno works as expected when STATUS is the only audited attribute. If you audit multiple attributes, you will get duplicated records because each modification is stored individually in the A_ASSET table, and the A_ASSET table does not include information about the nature of the modification (which attribute was changed).

    To over come this situation, you should modify the relationship definition to use a where clause like this (the example is made for oracle):

    assetnum = :assetnum and siteid = :siteid and EAUDITTRANSID in
    (
    select c.EAUDITTRANSID
    from ( select status, assetnum, siteid, EAUDITTRANSID, ROW_NUMBER() OVER (PARTITION BY assetnum order by EAUDITTIMESTAMP) as transid from A_ASSET a1
    where a1.assetnum = :assetnum and a1.siteid = :siteid with read only) c

    inner join ( select status, assetnum, siteid, EAUDITTRANSID, ROW_NUMBER() OVER (PARTITION BY assetnum order by EAUDITTIMESTAMP) as transid from A_ASSET a2
    where a2.assetnum = :assetnum and a2.siteid = :siteid with read only) p
    on p.transid = c.transid -1 and p.assetnum = c.assetnum and p.siteid = c.siteid and ( p.status is null or p.status != c.status )
    where c.assetnum = :assetnum and c.siteid = :siteid

    union all
    select EAUDITTRANSID from A_ASSET a
    where assetnum = :assetnum and siteid = :siteid
    and EAUDITTIMESTAMP = (select min(EAUDITTIMESTAMP) from A_ASSET where assetnum = :assetnum and siteid = :siteid group by assetnum, siteid)
    )

    Using this relationship, you only get status changes, and filter out all the unrelated records in the A_ASSET table.
    However, the relationship where clause does loop over the A_AUDIT table several times, and will perform poorly until you create two indices on the A_AUDIT table. One on siteid, assestnum and one on siteid, assestnum, eaudittransid, eaudittimestamp. Unfortunately you are not allowed to create the index using the Maximo Database Administration app, so your DBA must create this index manually. Just ensure that the indices is not unique.

    Happy auditing

  6. Thank you for your guide.

    I want to view tracking change “Long description” show on tab “History”. How can I do it?
    Please help me!

Leave a Reply to PhanPhu Cancel reply

Your email address will not be published. Required fields are marked *

Scroll to top