Share Report data in a form look - not data list view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 01:11 PM
Hello Community,
Is there a way to create a document where each line of data in a Report list view is on its own page with the data shared looking like a Form, not a line of data? We're trying to create Shipping reports to serve as Receipts for end users who do not have access to the ServiceNow platform. The documents need to be intuitively readable by the staff.
The Report query is built, but struggling with presentation of the data. Appreciate any help on this topic!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 01:30 PM
To facilitate the creation of shipping receipts for end users who lack direct access to the ServiceNow platform, you can leverage a custom HTML template within ServiceNow. This template transforms each line of data from a report list view into its own page, presenting the information in a user-friendly, form-like layout. Here's a simplified process to achieve this:
1. Designing the HTML Template: Develop a bespoke HTML template tailored to your requirements. This template will define the layout for each page of the report, utilizing HTML and CSS to craft a form-like appearance. Each line of data from the report will seamlessly transition into its own page within the document.
2. Iterating Through Report Data: Employ JavaScript to iterate through the data extracted from your report. With each iteration, dynamically generate HTML content representing a line of data. This process enables you to populate the form fields within the HTML template with the pertinent information retrieved from each record.
3. PDF Generation from HTML Template: Utilize a PDF generation library or service to convert your meticulously crafted HTML template into a polished PDF document. This step can be executed either through a server-side solution integrated within ServiceNow or by leveraging an external service adept at transforming HTML to PDF format.
4. Delivery of PDF to End Users: Upon successful generation of the PDF document, distribute it to end users via various channels such as email, file downloads, or printing. This ensures accessibility to the shipping receipts for stakeholders who may not have direct access to the ServiceNow platform.
Here's a simplified example of the HTML template implementation:
<!DOCTYPE html>
<html>
<head>
<title>Shipping Receipts</title>
<style>
/* Define styles for form-like layout */
.container {
width: 80%;
margin: 0 auto;
}
.row {
margin-bottom: 20px;
}
.label {
font-weight: bold;
display: inline-block;
width: 150px;
}
.value {
display: inline-block;
}
</style>
</head>
<body>
<div class="container">
<h1>Shipping Receipts</h1>
<!-- Loop through each record from the report -->
<% var records = /* fetch report data */;
records.forEach(function(record) { %>
<div class="row">
<div class="label">Order Number:</div>
<div class="value"><%= record.order_number %></div>
</div>
<div class="row">
<div class="label">Customer Name:</div>
<div class="value"><%= record.customer_name %></div>
</div>
<!-- Add more fields as needed -->
<% }); %>
</div>
</body>
</html>
In this example, placeholders like <%= record.order_number %> and <%= record.customer_name %> dynamically incorporate data from each record. Ensure to substitute them with actual field names from your report.
Upon creation of the HTML template, select an appropriate PDF generation solution to convert it into a finalized PDF document. Your choice may vary depending on preferences and specific requirements.
Regards,
Masoom