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:
- Enable audit of the main object and select attributes to be audited
- Define relationship to the audit table
- Customize the application to display the audit log from the UI
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.
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
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">
<multiparttextbox dataattribute="assetnum" descdataattribute="description" id="myhist_grid1_1"/>
<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"/>
6 thoughts on “Tracking changes using Audit feature”
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
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
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.
An audit is necessary in order to find those mistakes that were made and correct them for normal functioning.
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
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
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.
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!