Issue
How to modify the fields that are exported into a PDF file from the Service Portal Form widget. Is it possible to select different fields to be exported in a PDF?
Resolution
By default, the fields exported into a PDF file are the same displayed in the Form widget, which are the fields displayed in the Service Portal view (sp). However, this behavior can be changed after a customization, and different fields can be displayed in the form and be exported.
To do this:
- Create a new view and form for the table you are using, for example, the incident table.
- Clone the Form widget
- Edit the Form widget. Go to Line 40 and 4 in the HTML Template section. You will see:
<li><a target="_new" href="/{{data.f.table}}.do?PDF&sys_id={{data.sys_id}}&sysparm_view={{data.f.view}}">${Export to PDF}</a></li>
<li><a target="_new" href="/{{data.f.table}}.do?PDF&landscape=true&sys_id={{data.sys_id}}&sysparm_view={{data.f.view}}">${Export to PDF (landscape)}</a></li>
4. Change the value of the parameter sysparm_view parameter to the view you want to use for the PDF file, for example pdfview:
<li><a target="_new" href="/{{data.f.table}}.do?PDF&sys_id={{data.sys_id}}&sysparm_view=pdfview">${Export to PDF}</a></li>
<li><a target="_new" href="/{{data.f.table}}.do?PDF&landscape=true&sys_id={{data.sys_id}}&sysparm_view=pdfview">${Export to PDF (landscape)}</a></li>
5. Save.