A report for check the CMDB attribute changed and it's value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2023 02:24 AM
Hi,
I'm looking for report that can capture the CMDB CI attributes updates/changes
E.g. cmdb_ci_computer, a CI 'Owned by' name field is updated from staff A to staff B, any way can show that CI changes with both staff A & B value in a report?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2023 02:38 AM
This feature can be enabled on any table in the system, including the CMDB and its associated tables like cmdb_ci_computer
. When auditing is enabled, every time a record is updated, the system records the field that was changed, the old value, the new value, when the change was made, and who made the change.
To create a report that captures the CI attributes updates/changes, you can follow these steps:
-
Enable Auditing: If auditing isn't already enabled for the
cmdb_ci_computer
table, you need to enable it. This can be done by going toSystem Definition > Tables & Columns
, finding thecmdb_ci_computer
table, and checking theAudit
box. -
Create a report based on Audit Log: Once auditing is enabled, you will be able to create a report based on the Audit Log.
- Go to
Reports > Create New
. - Choose
Table
as your data source and select theAudit [sys_audit]
table. - In the filter criteria, set
Auditable Record
to thecmdb_ci_computer
record you're interested in. - Set other filters as needed. For example, if you're interested in the 'Owned by' field, you can set
Field name
to 'Owned by'. - Configure the columns of your report to include
New Value
andOld Value
.
- Go to
---------------
Regards,
Rajesh Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2023 06:30 PM - edited 05-15-2023 06:31 PM
Thanks your response and I got the below result, however cannot locate the exactly CI names, Old/New value but with sys_id only in report, any clue? and is it admin role can access to sys_audit table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2023 02:52 AM
Hi @MB Ng ,
I trust you are doing great.
To capture CMDB CI attribute updates/changes, you can create a report using the ServiceNow platform. Here's how you can achieve this:
1. Navigate to the ServiceNow homepage and go to the "Reports" module.
2. Click on "Create New" to start creating a new report.
3. Select the appropriate table from the "Table" field. In this case, it would be "cmdb_ci_computer" for computer CI.
4. Define the desired filters and conditions to narrow down the report results. In your case, you want to capture changes in the "Owned by" field.
5. Add the required columns to the report. You can include the "Owned by" field to display the staff names.
6. To capture both the old and new values of the "Owned by" field, you'll need to leverage the "Audit" functionality in ServiceNow. You can use the `sys_audit` table to retrieve the historical values.
7. In the report, add an additional column for the previous "Owned by" value by writing a script to fetch the old value from the `sys_audit` table. Here's an example script that can be used:
```javascript
var gr = new GlideRecord('sys_audit');
gr.addQuery('documentkey', current.sys_id);
gr.addQuery('fieldname', 'owned_by');
gr.orderByDesc('sys_created_on');
gr.setLimit(1);
gr.query();
if (gr.next()) {
var oldValue = gr.oldvalue;
current.previous_owned_by = oldValue;
}
```
8. Save the report and give it a meaningful name.
9. Run the report, and you should see a list of CMDB CI attribute changes for the "Owned by" field, including both the old and new staff names.
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2023 05:57 PM - edited 05-15-2023 06:17 PM
Hi @Amit Gujarathi,
thanks your advise, in step 7, do we need to create a new column for previous value of Owned by? and it seems I can't locate the script button on report, any clue?
is it only Admin role can access to sys_audit table?