How can I query approval history and export audit data?

drodriguez2
Kilo Explorer

I'm having a couple of problems pulling some data needs to be reviewed periodically.

 

1. When a change, request or catalog task gets approved I need to be able to know the date it was approved. Ideally I'd like to know when the approval request was sent but that's not as important. I checked for an approval date field on sysapproval_approver table but there isn't one.

 

2. I need to be able to report on who approved something. For example, if an approval was sent out to Joe Smith but the approval was actually done by an admin and not Joe Smith how can I query that?

 

I did sort of find the information I need because in the audit history I can see when a ticket was changed to approved and who changed it but I don't know how to query that.

 

I also need to export all of the audit data when a change or request is exported into PDF. It seems like that information is left out even though it is being displayed on the form.

 

Any help with this would be appreciated.

 

Thank you

3 REPLIES 3

PeterWiles
Kilo Sage

The info you are looking for in 1 and 2 are shown on the audit table and not the actual table. I would create the required audit fields on the form and create a BR to set them when required.


1. when inserted/updated and state == requested, set date.


2. When approval changes to "approved" set approver (I assume this will be the updater of the record so you can use gs.getUserID()



In regards to audit date on the report, this is on the audit table. You could query this but since this tracks the majority of tables and has 10,000 of rows, it's not advisable on live.


Someone else might have a suggestion on reporting on this data.



Pete


drodriguez2
Kilo Explorer

That might be a viable solution for approvals going forward, but what about existing ones? And also, if this audit information shows up in the Activities log, shouldn't it export when the form is exported to PDF?


PeterWiles
Kilo Sage

The audit log, I am not sure about. Might want to ask HI if no one else can answer but I am not sure it's possible. Could put it through as an enhancement request.



In regards to existing ones, I can't see any easy way. You could always do a background script to make the two fields from the last updated user as I am guessing in the majority of cases, once an approval is approved, no one else is going to update it.



Pete