Order of execution of the clone cleanup scripts?

Linda Kendrick
Kilo Guru

Anyone know what order the clone cleanups script are executed? We created a script and it has to run last.

I looked at System Clone - ServiceNow Wiki   and don't see any order.

  • Disable emails: Disables email on the target instance. A default data preserver maintains other email settings from the target instance.
  • Regenerate text indexes: Rebuilds text indexes on the target instance after a clone. Text indexes are not cloned from the source to the target instance.
  • Clear scheduled job node association: Resets any scheduled jobs that were active on the source instance to the Ready state. This script also clears the value of the System ID and Claimed by fields on all scheduled jobs.
  • Install deactivated plugin: Enables the Domain Separation plugin for instances that use this feature.
  • Drop backup tables: Schedules the deletion of the data contained in the target instance database prior to the clone. This original data is preserved for 24 hours following a clone to allow you to roll back an instance to the pre-clone state. If the target instance is downgraded as part of the clone, backup data is not available.
12 REPLIES 12

Would a manually scheduled job be an option to run after the clone was completed? Not sure how would determine the start time.  


If the clone cleanup scripts were in 1 big script then what would happen to the OOB clone scripts?



The reason we need the order is we have a test email group that needs to be active that only members of this groups receive email from the sub-production instance. We don't want any emails from the email outbox from the production clone to be sent.


The emails aren't transferred over in the clone. They are blocked by "System Clone > Clone Definition > Exclude Tables" by default. There is an Exclude Table record for the base sys_email table and a wild card record all "shards" in case your email is table rotated/extended, sys_email0*.


See Exclude a table from cloning


Hi Matthev,



Can this script will be executed directly in script background ? I am planning to write a script to regenerate all table indexing. Right now we have to do one by one manually in each environment. I found found a couple of method but have not yet tried and found your article so though to cross check if you had tried to do similar ?



Here are the approach found so far:



Method 1: (One by one add table)


indexer.createIndex("task", "email address");


*************************************************************************


Method2:


/**


* Fires an event which will cause the entire table to be re-indexed


*


* @param {string} tableName The table to be re-indexed


* @param {string} notifyEmailAddress The email address to be notified once the indexing is complete (optional)


*/


function fireTableIndexEvent(tableName, notifyEmailAddress) {


gs.eventQueue('text_index.all', null, tableName, notifyEmailAddress, 'text_index');


}


*************************************************************************


Method3:


System Clone >> Cleanup Scripts >> Regenerate all text indexes


new GlideTextIndexEvent().indexAllNoPurge();



Thank you for your help.



Regards,


Vivek Kesarvani


I just added an enhancement request in HI to add an "Order" column to the Clone Cleanup Scripts table and would encourage others to do so as well  


Did as well.