Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to set repeat interval for scheduled job based on condition?

poojashah27
Giga Guru

i would like to run send out email on last saturday of the month, how can i achieve that using scheduled job?

thanks

1 ACCEPTED SOLUTION

Hi Pooja,



Step 1, create an event. Event Registry - ServiceNow Wiki


Step 2: Create your scheduled job script. The scheduled job will only trigger an event if it meets the criteria I specified above "it is saturday, and it is the last saturday." Use gs.eventQueue() to trigger the event. GlideSystem - ServiceNow Wiki


Step 3: Create a notification that reacts to the event. Events and Email Notification - ServiceNow Wiki


View solution in original post

13 REPLIES 13

thanks Tom. I will give it a try.


HI Tom,



i put all pieces as you suggested but i am stuck at point where i am not able to see logs which i put in conditional part of schedule script. is there any way i can see logs/ or debug my script which is in condition section of schedule script?



find_real_file.png


Change your gs.print statements to gs.log. They will show up under System Logs> System Log> Script Log statements.



Also, consider using scripts background to test your script.



Faster Server Side Script Development and Test


thanks Chuck.



i tried going to scripts background, but i saw blank page. even though i am sys admin, do i need special permissions to run scripts background?


Depending on the release of ServiceNow, you may need to elevate your access to security_admin. Starting in Helsinki, this is no longer required.



Elevate to a privileged role