Edit the Attachment UI page for Change Request

Apurva Jogal
Kilo Sage

Hi, 

I want to hide "Remove" button from attachment UI page. This is for Change Requests where state is Authorize.

ApurvaJogal_0-1737366873460.png



How to achieve this?




This requirement is to confirm that no one can delete the attachment once change request is approved.

 

1 ACCEPTED SOLUTION

Viraj Hudlikar
Tera Sage

@Apurva Jogal 

 

Check this link Solved: User should not able to delete attachment in chang... - ServiceNow Community

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

View solution in original post

4 REPLIES 4

Viraj Hudlikar
Tera Sage

@Apurva Jogal 

 

Check this link Solved: User should not able to delete attachment in chang... - ServiceNow Community

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

Community Alums
Not applicable

Hi @Apurva Jogal 

can try following script on client side.

function onLoad() {
// Check if the current Change Request state is 'Authorize'
var state = g_form.getValue('state');

if (state == 'Authorized') {
// Hide the 'Remove' button in the attachment section
var removeButton = document.querySelector('.attachment-delete'); // Use the correct class selector for the button
if (removeButton) {
removeButton.style.display = 'none'; // Hide the Remove button
}
}
}

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Apurva Jogal 

why to remove?

It's an OOB ui page which gives capability to users to remove file if they wish to

2 ways to handle

1) you can have before delete BR on sys_attachment which checks that the CHG is in which state and based on that abort the deletion

OR
2) create a new delete ACL on sys_attachment or update an existing one and GlideRecord and see if user is authorized to delete

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Apurva Jogal 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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