Scheduled Job to create csv file?

greg54
Tera Expert

Hello,

Is it possible to create a CSV file in a scheduled job script and either email it to someone and/or add it as an attachment to a knowledge base article? The CSV file would need to be custom built in the script. What is the best way to accomplish this?

Thanks in advance!

2 REPLIES 2

john_andersen
Tera Guru

It's probably possible with a great deal of scripting. Wouldn't it be easier to just have a scheduled job send a link that the user can click on to have a CSV file generated?

See the major CSV export options here:
http://wiki.servicenow.com/index.php?title=CSV_Web_Service

But in essence, you could have it send out a URL such as:

https://MYINSTANCE.service-now.com/incident.do?CSV&sysparm_query=active=true^caller_id=681ccaf9c0a8016400b98a06818d57c7^priority=1


Another idea that may work for you: I know you can create reports that bring in data from one or more tables in ServiceNow. You can also schedule an email to be sent with a copy of that report in a certain format to be attached to the email.

If the report is in "List" format, then you should be able to click the "Schedule" button on the report and set up the scheduled email, with a corresponding message. You can send it in a number of formats, and CSV is one of them.

On the schedule you choose, the system will send out an email with the CSV version of the report sent out.