PDF Export Without Related Lists

stevejarman
Giga Guru

Hi - this topic has been hinted at here and there but I haven't found a solution as yet.

I have a custom view for our Incident form which is the "Customer PDF Export" view. It's basically a limited information view of the incident, and onLoad, it uses g_form.hideRelatedLists() to... hide the related lists. All works fine.

Problem is, when you them export that to PDF using the built-in context menu, the related lists show up in the PDF.

Does anyone know if there's a way to correct this behaviour, OR - failing that - some other way to customise the PDF output?

1 ACCEPTED SOLUTION

venkatiyer1
Giga Guru

Hi Steve,



These are the steps you might want to try out in order



1. Create   a new view say Print from Form Layout and ensure only the sections you want is there and save


2. Go to the Print view. Then right click again on the form and go to related lists. Remove the related lists for this view and save.



Then you would be able to access the print without related list say using a url



instance.service-now.com/nav_to.do?uri=/incident.do%3Fsys_id%3D282c3edc4f9256007e04c4b18110c7e9%26sysparm_view%3Dprint%26PDF




Replace the instance with your instance name, view with the view name your prefer and the sysid accordingly. %26 is the & equivalent.


View solution in original post

5 REPLIES 5

venkatiyer1
Giga Guru

Hi Steve,



One of the ways to get a customized pdf is using a mid server. I have detailed in the idea blog below.



Customized Print Solution using MidServer



If it just hiding the related list , one suggestion i have for your   scenario is to create   a view and then use that while using the PDF webservice using ?PDF. If that doesnt still work, we can may be create a custom public processor.


Thanks for the response - can you elaborate on "PDF webservice using ?PDF"? Or possibly provide a link to some doco?


Hi Steve,



Below is the link for documentation



http://wiki.servicenow.com/index.php?title=PDF_Web_Service#gsc.tab=0



For e.g say you want to show an incident table in a different view with no related list in it and download it as PDF format



https://instance.service-now.com/incident.do?PDF&sys_id=0c804d890a0a3c1800e6334c7504a474&sysparm_vie...



ess can be replaced with view name you created.



To create this above url, you can test it initially by getting the sys id of the record but if you want to give that provision to user you can create a UI action and take the current.sys_id to make the URL for PDF generation.


That's very cool - didn't know you could do that.



It gives the same result though as manually using the "Export PDF" option - i.e. it still shows the related lists.