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

How to disable/hide Remove button in Manage Attachments when state is not New (Change request application)?

Akkapolk
Giga Expert

find_real_file.png

 

find_real_file.png

1 ACCEPTED SOLUTION

Devyani_6
Mega Guru

Hi,

 

By using Client script, you can achieve that. Go through below thread, this will helps you.

How to Hide Attachment icon

 

Mark Correct/Helpful, if this resolve your query.

Regards,

Devyani

www.dxsherpa.com

View solution in original post

8 REPLIES 8

Alikutty A
Tera Sage

Hi,

This should work with an ACL, You need to add a Table level delete ACL on the sys_attachment table (sys_attachment. None) with a scripted condition.

The ACL script will validate if the attachment table_name=change_request and fetch the change request record by accessing on the table_sys_id field to validate its current state.

Thanks!

Thank you very much.

ABDUL17
Kilo Contributor

By using Onchange Client Script we can Hide Attachment easily,

Community Alums
Not applicable

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