where to check post clone cleanup script run or not run

kushal_dangare
Tera Expert

Hi,

I have created one post clone cleanup script. I am not seeing it executed after the cloning.

Where can I check if its run or not run? Where to check the logs of any failure of this script?

1 ACCEPTED SOLUTION

simonpullen
ServiceNow Employee
ServiceNow Employee

Hello Kushal,

 

After a clone completes the post clone cleanup script is created as a scheduled job and runs to completion and then is removed.

 

The best way to audit and keep a track of if the script runs is to add log statements in the job so you can audit it quickly.

EG:

 

gs.log("Starting Script to remove email configuration");

< Code to process >

 

gs.log("Script to remove email configuration is completed");

 

You can also put some log statements in the code to give more details instead of just start and finish, you can add counts and checks to better debug the script if it didnt work as intended.

 

Regards,

 

Simon

View solution in original post

9 REPLIES 9

 

I reviewed this again and in our clone FAQ we go over this. So we are still restricted by RCA and granting permissions, so HR is a specific app that is locked down in a way that you wouldn't be able to create those specific jobs causing a security issue unless already approved and created.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0715621#mcetoc_1h7f77i69ag

 

hope this helps

 

James Fricker
Tera Guru

And the single threaded clone cleanup scheduled script does not use try/catch so if one script fails, all subsequent scripts do not run?

I believe so based on the article shared. That could be the only possible reason why my scripts also aren't executing 

Yes that could be why, you can put specific logs in your cleanup scripts to confirm if they run, I know a number of customers so this so they can quickly audit if the job ran and how many records were adjusted.

 

But yes unfortunately if an earlier script fails then the other scripts after will fail.

Bert_c1
Kilo Patron

Clone cleanup scripts ran as scheduled jobs as the 'system' user previously. if this behavior hasn't changed, you will need a workaround.