To disable "Remove / delete" option in attachment for closed ticket

shraddhap
Tera Expert

Hello,

When any Incident or Change is closed, user should not be able to delete or remove attachment from closed ticket.

Remove / Delete option should be disable on closure of ticket.

Regards,

Shraddha

11 REPLIES 11

But doesn't that disable ALL attachments? Not just the ability to not allow removals?

shraddhap
Tera Expert

Hello All,



Thanks for the suggestion and reply.



But I also need to disable the "Remove" button on closed request when we click on attachment icon (paperclip icon).



Please find attached screenshot.



Regards,


Shraddha


The easiest solution would be to use this method and disable the attachment


http://wiki.servicenow.com/index.php?title=GlideForm_%28g_form%29#disableAttachments



and add the out of the box 'attachment' related list to your form rather than doing DOM manipulation and other UI changes


Thanks for the reply.



Could you please tell me, how its achievable through UI page?



As I need to disable from there only when any request closed.



I tried below code, but its not working.



function setRemoveButton() {


  var removeButton = gel("removeButton");


  var st = g_form.getValue(state);


  if (st == '3')


  removeButton.disabled = "true";


  else


  removeButton.disabled = "";


}



Your help is appreciated.



Regards


When you do this



g_form.disableAttachments();


  var att= gel('header_attachment_list_label');


  if(att!=''){


  att.style.display = 'none';


  }



It will hide the paper clip and also the manage attachments link, so you will just have the attachments at the top that you can view, you cant add/remove attachments


-Anurag