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

Debug is not working

Zosy
Giga Contributor

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 ! 

1 ACCEPTED SOLUTION

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).

find_real_file.png

View solution in original post

8 REPLIES 8

script include ,we are calling from schedule job .

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).

find_real_file.png

Musab Rasheed
Tera Sage

Hi Zosy,

How did you enable Debugging.? share steps what you have done

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

 

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