Attachment Remove button hide only for change request table

shravan3
Kilo Expert

Hi ,

Please let me know how to hide/disable attachment the remove button only change request table ?

No user should not able to delete the attachment

Thanks & Regards,

Shravan Kumar

15 REPLIES 15

Anurag Tripathi
Mega Patron
Mega Patron

Hi shravan



Is this what you are looking for



6 Disabling Attachments on a Table

To prevent attachments from being added to records on a specific table:


  1. Open a record in the table.
  2. Right-click in the header bar and select the appropriate option for your version:
    • Fuji or later: Configure > Dictionary
    • Eureka or earlier: Personalize > Dictionary
  3. In the list of dictionary entries, select the first record in the list (the record with no Column name entry).
  4. Add no_attachment to the Attributes field, separated by commas from any existing attributes.
    See Dictionary_Attributes for more information.
-Anurag

If you just want to make sure that no attachment is deleted (on change request)



Most neat way to do it would be a before delete business rule on sys_attachment table(with condition that it comes from change) and abort transaction in that business rule with a proper message.


-Anurag

avinash kumar
Tera Expert

Hi,



Please add a onLoad Client Script for change request table and use below:




function onLoad()


{


var state = g_form.getValue('state');



if(state == '3')// Replace this with your condition if any


g_form.disableAttachments();


}


This will work.



Regards,


Avinash


Gaurav Bajaj
Mega Sage

Hi Shravan,



I think you can make changes in attachment UI page to make it work apart from adding a BR as suggested by Anurag,




WIth below solution, I am trying to restrict the call made to activate remove button on checking the attachment box.


Try with below code block in the UI page.



1) search for setRemoveButton in the HTML part of UI page and replace the input tag with the code below. setRemoveButton n



<j:choose>


<j:when test="${jvar_target_table=='change_request'}" >


<input name="sys_id_$[sys_attachment.sys_id]"


id="sys_id_$[sys_attachment.sys_id]" title="${gs.getMessage('Delete attachment')}"


onclick="displayRemoveMsg(this)" type="checkbox" />



</j:when>



<j:otherwise>


<input name="sys_id_$[sys_attachment.sys_id]"


id="sys_id_$[sys_attachment.sys_id]" title="${gs.getMessage('Delete attachment')}"


onclick="setRemoveButton(this);" type="checkbox" />



</j:otherwise>


</j:choose>




2) And then in script part, add this new method displayRemoveMsg added in the code.



function displayRemoveMsg(record){



record.checked=false;


alert("Removing the attachment is not permitted on this table");




}




This will restrict users to remove any attachment from change request table once they have uploaded it.


find_real_file.png



Thanks


Gaurav