How to delete a document template ?

Sarah_P
Tera Expert

Hello,

 

In Utah I have created several HTML document template that I now want to delete.

 I can't seem to find how. Templates are in Editing state.

1 ACCEPTED SOLUTION

Sarah_P
Tera Expert
In the end I created the following Fix Script in the scope of the Document Template to put the Templates I wanted to delete in Draft state.

 

 

 

var docTemplateIds = [
    '38e1ea601b59fd108cf1dce0b24bcbc8',
	'1099aeac1b59fd108cf1dce0b24bcbbb',
	'0ba9aeac1b59fd108cf1dce0b24bcbbf'
];

var gr = new GlideRecord('sn_doc_html_template');

gr.addQuery('sys_id', 'IN', docTemplateIds);
gr.query();
while(gr.next()) {
    gs.info("Deleting Document Template : " + gr.name);
	gr.setValue('state', 'draft');
	gr.update();
}

 

 

Then I deleted them from the list.

View solution in original post

6 REPLIES 6

Hello Moonie !

 

Thanks for the answer.

These are exactly the documents I was mentioning. However, the delete button appears neither on the form nor in the contextual menu nor on the list view.

It seems, I can't delete Documents in Editing or Published state.

Sarah_P
Tera Expert
In the end I created the following Fix Script in the scope of the Document Template to put the Templates I wanted to delete in Draft state.

 

 

 

var docTemplateIds = [
    '38e1ea601b59fd108cf1dce0b24bcbc8',
	'1099aeac1b59fd108cf1dce0b24bcbbb',
	'0ba9aeac1b59fd108cf1dce0b24bcbbf'
];

var gr = new GlideRecord('sn_doc_html_template');

gr.addQuery('sys_id', 'IN', docTemplateIds);
gr.query();
while(gr.next()) {
    gs.info("Deleting Document Template : " + gr.name);
	gr.setValue('state', 'draft');
	gr.update();
}

 

 

Then I deleted them from the list.