Specifying fields in CSV export

finlay
Kilo Explorer

Hi,

I'm pretty new to developing with ServiceNow so any pointers on this one would be much appreciated. I'm creating a Google Apps Script writing a script that needs to be able to do an HTTP request to pull out a CSV of a search on Service Now. I have it working, however the CSV that is downloaded always contains the fields that I have set up in my dashboard when I log in through the web. For example, if in the web console, I have customised it to show me the state of a ticket and the date it was opened, that's what is outputted onto the CSV.

Below is an example of the URL I'm putting in requests, if you've any pointers on how to specify which fields to include, that would be much appreciated. Thanks!

https://INSTANCE.service-now.com/task_list.do?CSV&sysparm_query=sys_class_name%3Dchange_request%5Eactive%3Dtrue%5Estate!%3D-50%5Ecompany!%3Df66b14e1c611227b0166c3a0df4046ff&sysparm_first_row=1

6 REPLIES 6

Sai Anna
ServiceNow Employee
ServiceNow Employee

I would recommend creating a new view on the list of table. Include which fields you would like to have in that view.       use following URL



https://<instance_url>/task_list.do?sysparm_view=<view_name>






Thanks,


Sai


Hit like, Helpful or Correct depending on the impact of the response






That seems to have solved it. Thanks so much for your advice!


Sai Anna
ServiceNow Employee
ServiceNow Employee

Awesome. if this solves your problem, please mark it as correct Answer. it helps other people who have this issue in future. if you have any other road blocks please let us know.






Thanks,


Sai.


Dave Smith1
ServiceNow Employee
ServiceNow Employee

Finlay Wright wrote:



t that needs to be able to do an HTTP request to pull out a CSV of a search on Service Now.


Does it need to be CSV? Would XML or JSON be easier to parse at the receiving end?