How can I delete a change template?

tomp
Kilo Contributor

We created a change template but it contains errors and we started again.

We could make the template Disabled.   However we would like to get rid of it altogether.

At the bottom of the page there's a drop-down menu "Actions", but all options except "New" are greyed out.

So how do we eradicate this template?

9 REPLIES 9

Chuck Tomasi
Tera Patron

Hi Anton,



Deleting templates is not a good idea for the same reason as deleting any other record from a referenced table. It can leave "hanging sys_ids". If you really must, you can go to the sys_template table, get the sys_id, and write a simple little script to run in scripts background.



Standard disclaimer: The following code is untested, requires review and potential modifications.


(function () {  



      var rec = new GlideRecord('sys_template');  


        if (rec.get('SYS_ID_OF_TEMPLATE'))


                  rec.deleteRecord();


})();  


I wish ServiceNow was smart enough to allow the delete if you are the owner and there are no references to the template


zica
Giga Guru

Peters,



Go to UI Action, search for delete button (Global), Open it, make true the list bottom menu and list context menu,


Now you will have a delete button at the bottom of your template form


Delete is already there, but it's likely disabled due to ACLs.