Musab Rasheed
Tera Sage
Tera Sage

Hello,

I had a requirement to provide Export to PDF option in Incident form in agent workspace with excluding few fields and related lists. Though export option is available in native UI without modification but export option itself was not available in agent workspace.

So I read few links in community which provided me hints about implementing this solution about providing Export to PDF option along with excluding fields, related lists which I don't want as part of export.

Here are the steps to achieve this.

1) Create new view in Incident form and add fields accordingly which you want to see in 'Export to PDF' view and save it. 

find_real_file.png

2) Now Change the view to 'Export to PDF' and go to related list and remove all, Once done save it and see form in 'Export to PDF' view will not have fields and related lists.

3) Now create one New UI action with a name 'Export to PDF' and make sure this is available only in Workspace but not in Native UI, follow below configuration

find_real_file.png

find_real_file.png

Code :

function onClick(g_form) {
  var url = '/' + g_form.getTableName() + '.do?sys_id=' + 
	  g_form.getUniqueValue() + '&sysparm_view=export_to_pdf&PDF';
  top.window.open(url, '_blank'); 
}

3) If you observe above code I have added View which I created 'pdf_export' and also added 'PDF', this will make sure when agent clicks on button, record will be downloaded as PDF but with 'pdf_export' view instead of 'workspace' view.

And with this I was able to add Export functionality along with excluded the fields and related list which I do want in PDF export.

4) Lastly go to agent workspace, Open Incident and click on button it will download PDF.

find_real_file.png

find_real_file.png

Please hit like or bookmark the Article in case that's helpful.

Feel free to correct me in case Article needs modification.

Best Regards

Comments
Carlos52
Tera Expert

Thanks for the article!

I didn't have the "Format for Configurable Workspace" checkbox available, but your explanation still helped me figuring out the solution. Subscribed. 🙂

Eivind Sandnes
Tera Contributor

Worked like a charm for scoped app as well!
Nice work! ❤️

Musab Rasheed
Tera Sage
Tera Sage

@Eivind Sandnes Thank you 🙂

BharathChintala
Mega Sage

@Musab Rasheed  

 

What if we want to keep this in Standard ticket configuration Tab?

 

Do you have any solutions?

BharathChintala_0-1687690141445.png

 

ServiceNowVS
Tera Expert

@Musab Rasheed - How can we make it work if we have dependent fields? For eg: the PDF displays all the fields in that current view even if that field is not on the form because it is a dependent field. How do we cater that scenario to only show dependent field when they are being set?

Sai Pragna Kone
Tera Explorer

hi @Musab Rasheed, there are some attachments in the related records. can you please suggest a way to capture that too in the pdf

Sreedhar3
Tera Contributor

Hi @Musab Rasheed , 

I am trying to get the Attachments as well from all the Related list records. Could you please help me on the same how we can fetch and place the names on the pdf which we are exporting.

 

Do we have that feasibility?

eyal abu hamad
Mega Sage

the button is not showing in my HR AGENT WORKSPACE

eyalabuhamad_2-1746428130467.pngeyalabuhamad_3-1746428135547.png

 

Version history
Last update:
‎06-28-2022 10:57 AM
Updated by: