The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Audit State Field

Stan Martin
Kilo Guru

I have a table that extends HR Case.  In that table is of course the State field.  I was successful in turning on auditing for that field and a record is being written to the sys_audit table, but the Old Value and New Value are blank.  Kind of defeats the purpose of auditing.

Any way to get those values to populate?

1 ACCEPTED SOLUTION

Stan Martin
Kilo Guru

Found the answer in this Community Post by @Harshvardhan 

https://community.servicenow.com/community?id=community_question&sys_id=2dbabbdddb820058d58ea345ca961988

It points to KB Article about Application Restricted Caller Access

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0759087

Found 2 records for the Script Include hr_CoreUtils in Requested status.  Moved both of those to Allowed.

The sys_audit table now shows the Old and New Values for the State field.

View solution in original post

8 REPLIES 8

Community Alums
Not applicable

Hi @Stan Martin ,

There's a utility that can help you with that:   GlideScriptRecordUtil.   It stores the fields and values of changes on an update.

Please refer to this link to learn more : a great example of its use on ServiceNowGuru.

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Stan Martin
Kilo Guru

Evaluator.evaluateString() problem: java.lang.SecurityException: GlideScriptRecordUtil is not allowed in scoped applications: com.glide.script.fencing.GlidePackageScopeHandler.found(GlidePackageScopeHandler.java:28)

 

As usual with ServiceNow, the good stuff won't work in a scoped app.

shloke04
Kilo Patron

Hi @Stan Martin 

As far as I know , this should work for you. 

Couple of points to note here, when you switched on the Auditing, where have you done that?

Reason for checking this is because when you extend a Table from HR Case, state is a field which is coming from task table, so the correct way of to switch on Audit for your custom table will be as below:

1) Open your Custom table form and then Right click on the State Field and then select Configure-->Dictionary and then scroll down to the Related List named as "Dictionary Override" as shown below:

find_real_file.png

Now click on New and create a Entry for your Custom Table and update the attribute as below:

audit = true;

find_real_file.png

Have you tried this way? If yes, can you share screenshot of the Audit table where it is coming as blank?

Please refer to below HI article as well which may be helpful in this scenario:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0723730

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Stan Martin
Kilo Guru

find_real_file.png

The exact same steps I took when I turned on auditing for that field.  This is a screenshot of the Dictionary Override entry.