To disable "Remove / delete" option in attachment for closed ticket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2015 04:42 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2015 02:59 AM
Hello Anurag,
Thanks for suggestion. But I tried this solution earlier to hide paperclip icon and it works.
But I need to disable "Remove" option from "UI page" (attachment), when ticket gets closed.
Could you please tell me, how to achieve this?
For testing, I tried this code under UI Page (attachment), but its not working as expected.
function setRemoveButton() {
var removeButton = gel("removeButton");
var st = g_form.getValue(state);
if (st == '3')
removeButton.disabled = "true";
else
removeButton.disabled = "";
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2021 07:17 AM
Hi,
There are 2 ways to implement the solution to this.
1) first one is to disable the "Remove" button in UI page "Attachment".
However doing so will skip the UI page page from future upgrades thus take client's approval before doing so.
Below is the code changes i did to disable the Remove button.
line 64 -- >
function setRemoveButton(e) {
var removeButton = gel("removeButton");
if (g_form.getValue("state") != '-5') {
removeButton.disabled = "true";
} else { place OOB code here}
2) Second approach is to create a Delete ACL or Abort BR at Deletion on Sys_attachment table.
When abort takes place , update the custom created boolean field on table where attachment is present.
Hide the field on form by UI policy/client script but keeping it on form is important.
Once Abort BR(on before) on sys_attachment table is executed , add code to update custom field to true.
Create an on change client script which runs when custom field is true and reloads the form (g_form.save())
when the reload happens for that create a custom Display BR which runs when custom field is true and display error message for deletion and
sets back boolean field to false (so that the message doesn't appear on every reload.)
This is the best i could think of while working on this requirement
Please mark my answer helpful or correct if it helps you.
Regards
Gurvinder Singh