- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2014 03:47 AM
Hi all!
Basically we have unaudited cmdb_ci extended tables . I would like to have a report on all changed fields (status, etc) in CI which have specific support group assigned.
I have created a table u_ci_audit, which i will use to create report based on. it contains pretty same fields as history table (field name, old value, new value, CI name)
Created business rule to trigger when cmdb_ci record updated, inserted, deleted and it creates new record in audit table.
What is tricky is to create a script to create separate record in u_ci_audit table for each changed field in CI.
I don't want to track all fields with function .changes() separately.
Any ideas will be appreciated
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2014 04:03 AM
You can get all the fields of the form and apply changes() in a loop.
Below code is just an example of how you can refer to name/value of each field of a form.
var fields = current.getFields();
for (var i = 0; i < fields.size(); i++) {
var field = fields.get(i);
var name = field.getName();
var value = field.getDisplayValue();
gs.print(i + ". " + name + "=" + value);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 03:46 AM
here var fields = current.getFields(); getting all fields now I don't want all fields only selected fields I want to get for that I maintain one interface.
tablename auditfield1 auditfield2 auditfield 3
incident caller state Short Description
In that i mentioned table name and fields like as above now i need to check if values inserted/ updated i need to get field label, old value,new value of incident table in my custom audit table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2014 05:36 AM
Why not enable audit for these tables? Is your custom solution going to have some extra capabilities that are not available with the standard audit feature?
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2014 05:45 AM
Hi!
The main idea is to build and schedule report on changed fields of the supported CI in a scope for a given period.
It is not possible to do with the built-in audit table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 01:05 AM
Hello,
I think you should look at Metrics (and metrics definitions) in ServiceNow. You should be able to track when/how long which field had some values.
Philippe