Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to delete a document template ?

sarahpho
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

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

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