hide/show manage attachement in incident based on user role

pushparaj
Mega Contributor

HI all,

when you open incident form on the top right header label there is manage attachments button(paper clip icon).
i want it to be visible only user with some particular role (like only admin can see that icon) for all others its hidden.

Pls tell me what are the ways to achieve it.

1 ACCEPTED SOLUTION

k, then undo everything done so far.



Just write an onload client script to read the user role and if the user doesn't have the appropriate roles then just


g_form.disableAttachments();


-Anurag

View solution in original post

19 REPLIES 19

Hi Sir,
HR case state is closed complete the attachment icon should not be visible in the Portal.
how to achieve this? Does your solution work for the portal as well?

Rajesh T
Giga Expert

Try using onLoad() Client script.



if(!g_user.hasRole('admin')


{


    g_form.disableAttachments();


          var ma = gel('header_attachment_list_label');


          ma.style.display = 'none';


}


hi rajesh,



g_form.disableAttachments(); did the trick.



can you please tell me what this will be doing in the code.



var ma = gel('header_attachment_list_label');


          ma.style.display = 'none';



Thanks in advance


Manage Attachment Lable won't be visible.


anagha_girme
Kilo Contributor

Hello Jayanthi,



Write a OnLoad() client script on the required table:-


(Here role1 and role 2 are the required roles who are not needed to view the attachment icon)



if(g_user.hasRole('role1') || g_user.hasRole('role2'))


{


    g_form.disableAttachments();


    }




Note:- Please mark helpful if it works for you