Hide Remove button on attachment when incident/problem/change state is closed.

Sehreen
Tera Contributor

Hide Remove button on attachment when incident/problem/change state is closed via ACL to restrict deletion of the attachment.

3 ACCEPTED SOLUTIONS

iekosmadakis
Mega Sage

Hello @Sehreen !

An onLoad Client Script that utilizes g_form.disableAttachments() prevents users from adding or removing attachments through the UI. Note that existing attachments remain visible. So the Attachments popup will look like this:

iekosmadakis_0-1755501530318.png


Please consider marking my answer as helpful and accepting it as the solution if it assisted you in any way.

View solution in original post

Bhuvan
Kilo Patron

@Sehreen 

 

Create a client script to disable attachments when task state is resolved. Below is a sample Client Script created for Incident table, same logic can be applied to task table with condition tasktype [sys_class_name] is one of Incident, Problem, Change and State conditions.

Bhuvan_0-1755502390073.png

Bhuvan_0-1755503150575.png

function onLoad() {
//Type appropriate comment here, and begin script below
var incStatus = g_form.getValue('state');
if(incStatus == 6)   
{
g_form.disableAttachments();
}
}

Please note, this feature is not supported on mobile devices and below is the workaround,

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0682392

 

Alternate option is to change out of box ACLs but is not recommended due to complexity.

 

https://www.servicenow.com/community/itsm-forum/how-to-hide-remove-button-from-the-attachment-on-inc...

 

If this helped to answer your query, please accept the solution and close the thread.

 

Thanks,

Bhuvan

 

View solution in original post

Rafael Batistot
Tera Sage

Hi @Sehreen 

 


In client script try to find by “(BP) Hide Attachment Link when Closed” see if False. If yes change to True

 

The ServiceNow already have a condition to avoid attached


See reference

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0696020

 

View solution in original post

4 REPLIES 4

iekosmadakis
Mega Sage

Hello @Sehreen !

An onLoad Client Script that utilizes g_form.disableAttachments() prevents users from adding or removing attachments through the UI. Note that existing attachments remain visible. So the Attachments popup will look like this:

iekosmadakis_0-1755501530318.png


Please consider marking my answer as helpful and accepting it as the solution if it assisted you in any way.

Bhuvan
Kilo Patron

@Sehreen 

 

Create a client script to disable attachments when task state is resolved. Below is a sample Client Script created for Incident table, same logic can be applied to task table with condition tasktype [sys_class_name] is one of Incident, Problem, Change and State conditions.

Bhuvan_0-1755502390073.png

Bhuvan_0-1755503150575.png

function onLoad() {
//Type appropriate comment here, and begin script below
var incStatus = g_form.getValue('state');
if(incStatus == 6)   
{
g_form.disableAttachments();
}
}

Please note, this feature is not supported on mobile devices and below is the workaround,

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0682392

 

Alternate option is to change out of box ACLs but is not recommended due to complexity.

 

https://www.servicenow.com/community/itsm-forum/how-to-hide-remove-button-from-the-attachment-on-inc...

 

If this helped to answer your query, please accept the solution and close the thread.

 

Thanks,

Bhuvan

 

Rafael Batistot
Tera Sage

Hi @Sehreen 

 


In client script try to find by “(BP) Hide Attachment Link when Closed” see if False. If yes change to True

 

The ServiceNow already have a condition to avoid attached


See reference

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0696020

 

Sehreen
Tera Contributor

These were helpful. Thank you!