Where to add ?CSV in URL to export file directly

Mike273
Kilo Contributor

I am trying to define a URL to directly export a Report as a CSV file.  The following post  covers this, but uses a very simplified report URL. In my case, I have a more complicated URL and cannot seem to figure out where to add the ?CSV "export format processor" to make this work.  The Export directly from a URL guide is great, but again, shows a much simpler URL than what I am working with.

Can someone help me modify the following Report URL (<instance name> replaced) so it exports the report as CSV?  Any help appreciated.

https://<instance name>.service-now.com/nav_to.do?uri=%2Fsys_report_template.do%3Fjvar_report_id%3D9fba9c80db710854c2c213853296198c%26jvar_selected_tab%3DallReports%26jvar_list_order_by%3D%26jvar_list_sort_direction%3D%26sysparm_reportquery%3D%26jvar_search_created_by%3D%26jvar_search_table%3D%26jvar_search_report_sys_id%3D%26jvar_report_home_query%3D

 

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

The &CSV should work fine. Trick is the URL. Your example URL contains nav_to.do which will not work. What should work is:
https://<instance name>.service-now.com/sys_report_template_list.do%3Fjvar_report_id%3D9fba9c80db710854c2c213853296198c%26jvar_selected_tab%3DallReports%26jvar_list_order_by%3D%26jvar_list_sort_direction%3D%26sysparm_reportquery%3D%26jvar_search_created_by%3D%26jvar_search_table%3D%26jvar_search_report_sys_id%3D%26jvar_report_home_query%3D&CSV

(or at least I attempted to edit your example URL)

 

So you need to open the list in a new window. For example, CTRL+Left mouse click opens a Module in a new window. A new window, without the navigator, so without the nav_to.do?uri etc.. Then simply add &CSV.

Here an example for all active incidents:
https://<instance_name>.service-now.com/incident_list.do?sysparm_userpref_module=b55fbec4c0a800090088e83d7ff500de&sysparm_query=active%3Dtrue%5EEQ&active=true&sysparm_clear_stack=true&CSV

(= tested)

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

5 REPLIES 5

Tony Chatfield1
Kilo Patron

Hi, like any issue the first step is to test in an OOB instance then take a look at the log files, my results are below and superficially at least they suggest that the posts that imply this is possible are incorrect.

Exporting of reports by this method is not covered by the documentation referenced, and I wasn't able to find anything relevant to exporting of reports via url (although my search was not in-depth).
Perhaps there is a bug or it once was possible and the method is obsolete.

The documentation clearly states it is for export of data directly from table,
and the error seems to support this.

ErrorCannot export, no report specified: no thrown error
Errorjava.lang.NullPointerException: java.lang.NullPointerException:
ErrorTable name cannot be null: java.lang.IllegalStateException: Table name cannot be null: com.glide.db.TableDescriptor.<init>(TableDescriptor.java:81)
com.glide.db.TableDescriptor.get(TableDescriptor.java:86)
com.glide.ui.SysList.getListRecords(SysList.java:505)
com.glide.ui.SysList.getListColumns(SysList.java:374)
com.glide.generators.ExportParameterHandler.getFields(ExportParameterHandler.java:108)
com.glide.processors.CSVProcessor.getFieldList(CSVProcessor.java:60)
com.glide.processors.ExportProcessor.export(ExportProcessor.java:130)
com.glide.processors.ExportProcessor.export(ExportProcessor.java:116)
com.glide.processors.CSVProcessor.process(CSVProcessor.java:50)
com.glide.processors.AProcessor.runProcessor(AProcessor.java:553)
com.glide.processors.AProcessor.processTransaction(AProcessor.java:240)
com.glide.processors.ProcessorRegistry.process0(ProcessorRegistry.java:177)
com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:166)
com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:31)
com.glide.sys.Transaction.run(Transaction.java:2203)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

 

Thanks for the inputs @Tony Chatfield.  I was afraid of that.  I am not fluent enough (or may not have access to log files), but after multiple attempts, looks like the URL structure for reports does not support this.  Seems odd thought.  Lists work fine, and as you said, some posts indicate reports do as well. 

Wish I could confirm that the "export format processor" can only handle single record or table URL's (eg: records and lists).  That would be a shame as the reporting capability allows the cross-table links I need and not being able to automate report CVS's is disappointing.  I might see about getting this question directly addressed to our SNow support team to see if they can confirm or provide and alternate path....

Mark Roethof
Tera Patron
Tera Patron

Hi there,

The &CSV should work fine. Trick is the URL. Your example URL contains nav_to.do which will not work. What should work is:
https://<instance name>.service-now.com/sys_report_template_list.do%3Fjvar_report_id%3D9fba9c80db710854c2c213853296198c%26jvar_selected_tab%3DallReports%26jvar_list_order_by%3D%26jvar_list_sort_direction%3D%26sysparm_reportquery%3D%26jvar_search_created_by%3D%26jvar_search_table%3D%26jvar_search_report_sys_id%3D%26jvar_report_home_query%3D&CSV

(or at least I attempted to edit your example URL)

 

So you need to open the list in a new window. For example, CTRL+Left mouse click opens a Module in a new window. A new window, without the navigator, so without the nav_to.do?uri etc.. Then simply add &CSV.

Here an example for all active incidents:
https://<instance_name>.service-now.com/incident_list.do?sysparm_userpref_module=b55fbec4c0a800090088e83d7ff500de&sysparm_query=active%3Dtrue%5EEQ&active=true&sysparm_clear_stack=true&CSV

(= tested)

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi @Mark Roethof 

how can triggered following url "

https://my instnace name /incident.do?CSV&sysparm_query=active=true^caller_id=5f067d0693b092108afcfb7c5cba1064" *in scheduled job in order to generate cvs in attachment table.
anitha0887_0-1727815626482.png

 

"