Skip to content
The Chat Archive
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…

  1. User

    In servicenow, is it possible to make a report on hardware table for every request with the number, for a particular assets

  2. 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:

    1. Identify the Tables:

      • The cmdb_ci_computer or cmdb_ci table is typically used for hardware assets.
      • The sc_req_item table is used for requested items in the Service Catalog.
    2. Create a New Report:

      • Navigate to Reports > Create New Report.
    3. Configure the Data Source:

      • Select the table that includes your hardware assets (cmdb_ci_computer).
    4. 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.
    5. 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.
    6. 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.
    7. 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_computer and sc_req_item tables based on common identifiers like Asset Tags or Serial Numbers.
    8. 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;
      })();
      
    9. 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.
    10. 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.