gpt-4o-2024-05-13· OpenAI WildChat-4.8M (AI2)
In servicenow, is it possible to make a report on hardware table for every request with…
- User
In servicenow, is it possible to make a report on hardware table for every request with the number, for a particular assets
- Assistant
Yes, in ServiceNow, you can create a report on hardware assets and link them to specific requests. Here’s a high-level approach to achieve this:
-
Identify the Tables:
- The
cmdb_ci_computerorcmdb_citable is typically used for hardware assets. - The
sc_req_itemtable is used for requested items in the Service Catalog.
- The
-
Create a New Report:
- Navigate to Reports > Create New Report.
-
Configure the Data Source:
- Select the table that includes your hardware assets (
cmdb_ci_computer).
- Select the table that includes your hardware assets (
-
Define the Conditions:
- If you need to filter specific hardware, you can add conditions such as Model, Manufacturer, or other identifying attributes of the assets.
-
Add Related Data:
- To include data from the request table, you need to use a database join. This can be done in the report designer by specifying related lists or using dot-walking.
-
Build Report Table:
- Add columns that you need in the report. For example, you can add the hardware asset number, asset name, and details from the request item table.
-
Join Tables via Scripted Reports (if needed):
- For advanced reporting, you might need a script to join tables that are not directly related. You can create a scripted report in ServiceNow that pulls in data from both
cmdb_ci_computerandsc_req_itemtables based on common identifiers like Asset Tags or Serial Numbers.
- For advanced reporting, you might need a script to join tables that are not directly related. You can create a scripted report in ServiceNow that pulls in data from both
-
Example Script:
(function() { var gr = new GlideRecord('cmdb_ci_computer'); gr.addEncodedQuery(''); // Add your filter criteria here gr.query(); var results = []; while (gr.next()) { var assetSysId = gr.getUniqueValue(); var requestGr = new GlideRecord('sc_req_item'); requestGr.addQuery('asset', assetSysId); requestGr.query(); while (requestGr.next()) { results.push({ 'Asset Number': gr.name.toString(), 'Request Number': requestGr.number.toString(), 'Request Date': requestGr.opened_at.toString() }); } } return results; })(); -
Saving and Running the Report:
- Save the configured report and run it to view the results.
- You can also schedule the report or export it as needed.
-
Dashboard Integration:
- Optionally, you can add this report to a dashboard for better visualization and accessibility.
This process involves using ServiceNow's built-in reporting tools to gather and relate data from the hardware and request tables, providing a comprehensive view of requests associated with specific hardware assets.
-