The CreatorCon Call for Content is officially open! Get started here.

Change - Restrict ability to remove attachments after approval.

snighu2495
Kilo Contributor

Hi all,

Can we restrict ability to remove attachment after changes are approved for Normal and Emergency Change Requests at Scheduled/Implement/Review/Closed States.

Please can any one suggest me other than acl.

Thanks,

Sindhu

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Sindhu,



ACL is the best option for this.


If not using then ACL then have onLoad client script on change request table and have following script. This uses DOM manipulation



condition will be if state = approved and type is either Normal or emergency



function onLoad(){



if(condition is true){


document.getElementById("header_add_attachment").style.display = 'none'; // this will hide the paper clip icon


// also you need to hide the Manage Attachments since user can delete the attachment from this as well



document.getElementById('header_attachment_list_label').style.display = 'none';


}


}




Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar @

 

I also have the same requirement but I want to restrict the user to remove the attachment but user should be able to attach additional attachments. Can we do this.

 

 

Regards,

Shriyansh

syedfarhan
Kilo Sage

Hi ,



I think ,You can write an Before delete business rule for the attachment table .



similar to like this:



if(tableName == 'change_request')  


{  


      Do a gliderecord and query only state is Scheduled/Implement/Review/Closed   .


        {  


                  return false;  


        }  


}  



Thanks,
Syed


Thanks Farhan ! Will definitely implement and let you know the output.