- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 11:12 PM
Guys ,
What could be the reason ?? for debug mode is not working !
I have chuck of code trying to debug but looks like it's not working ...can someone help me with it ?
Many thanks for your help !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 01:15 AM
Hm the code you've shown doesn't look much like a Script Include to me though.
Try to create a new Script Include and put everything in a function there (even in the 'initialize' should be ok) and add the breakpoints there.
Afterwards run 'new MYSCRIPTINCLUDE();' in a background script (if you placed the code just inside the initialize function). Then your breakpoints should trigger.
You cannot debug directly from a scheduled job because they will not run in your "Session" (they will run in the background by ServiceNow).
Btw: Please make sure that the Scheduled Job has the proper 'run_as' value (you have to edit this field via list-edit) - by default the user who creates the scheduled job is put in there. But if for some reason this account is ever getting deleted, the scheduled job will no longer run (so you need some kind of technical "ever existing" user account that will run scheduled jobs).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 12:13 AM
script include ,we are calling from schedule job .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 01:15 AM
Hm the code you've shown doesn't look much like a Script Include to me though.
Try to create a new Script Include and put everything in a function there (even in the 'initialize' should be ok) and add the breakpoints there.
Afterwards run 'new MYSCRIPTINCLUDE();' in a background script (if you placed the code just inside the initialize function). Then your breakpoints should trigger.
You cannot debug directly from a scheduled job because they will not run in your "Session" (they will run in the background by ServiceNow).
Btw: Please make sure that the Scheduled Job has the proper 'run_as' value (you have to edit this field via list-edit) - by default the user who creates the scheduled job is put in there. But if for some reason this account is ever getting deleted, the scheduled job will no longer run (so you need some kind of technical "ever existing" user account that will run scheduled jobs).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 11:17 PM
Hi Zosy,
How did you enable Debugging.? share steps what you have done
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2022 12:18 AM
I added breakpoints and gs.print() method to print the value
open that scriptdebbuger window in new
after that a copied the schedule job code and run this through background script