The CreatorCon Call for Content is officially open! Get started here.

Script to Rename Scheduled Report

kchorny
Tera Guru

We have a client who requires multiple reports periodically.  I have built these reports and they are scheduled to send to the account manager as required.  However, the account manager then has to upload the reports to the client's repository with a naming convention that starts with the date the report was run (YYYY-DD-MM).  IE Monthly Incident Report would be 2020-15-01 Monthly Incident Report.  The Account Manager is having to save each report locally with the new naming convention before he can upload them.

Is there any way I can script prefixing the report name with today's date before it is sent to the AM to save him some time?  

1 ACCEPTED SOLUTION

Prateek kumar
Mega Sage

Take a look at below thread.

https://community.servicenow.com/community?id=community_question&sys_id=7d1c8aa3db9d6304fa192183ca96...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

View solution in original post

6 REPLIES 6

Noah Drew
ServiceNow Employee
ServiceNow Employee

Hi @kchorny !

It appears that you can do this by adding JavaScript to the Subject line of the Scheduled Report form. Something such as this should work:

javascript:"Problems created on " + gs.now();

Take a look at this related post:

https://community.servicenow.com/community?id=community_question&sys_id=88b5cfeddbd8dbc01dcaf3231f96...

Hope that helps!

If it did, please mark as Helpful and consider setting the reply as the Correct Answer to the question, thanks!

Thanks for replying, but this solution adds the date to the subject line of the email, not to the report files attached to the email.

Prateek kumar
Mega Sage

Take a look at below thread.

https://community.servicenow.com/community?id=community_question&sys_id=7d1c8aa3db9d6304fa192183ca96...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Thank you, that might be exactly what I need.