The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Restrict view of attachments

Maria DeLaCruz
Giga Guru

Hi,

Need some help on restricting visibility of attachments.   For the Self-Service view of an incident, we would like an ESS user to be able to see only attachments they've added themselves to their incident, but not the ones that others (like ITIL users) have added.   But, the ITIL users should be able to see all attachments to incidents.   Any suggestions on how we can do this?

Thanks,
Maria

1 ACCEPTED SOLUTION

edwin_munoz
Mega Guru

I'm not completely sure that this will work but I think it is a good starting point



Create a business rule with the following information:



Name: Hide attachments to ESS users


Active: True


Advanced: True


Table: sys_attachment (Attachments)



Condition: !gs.hasRole("itil") && gs.getSession().isInteractive()



Script:



hideAttachments();



function hideAttachments(){


        var answer = 'sys_created_by=' + gs.getUserName();


        current.addEncodedQuery(answer);


}



EDIT: I just tested this, it works. Only problem is that users that doesn't have itil role will not be able to see attachment from others in the whole instance. Is this a problem? I'll think on how to fix this.


View solution in original post

15 REPLIES 15

edwin_munoz
Mega Guru

I'm not completely sure that this will work but I think it is a good starting point



Create a business rule with the following information:



Name: Hide attachments to ESS users


Active: True


Advanced: True


Table: sys_attachment (Attachments)



Condition: !gs.hasRole("itil") && gs.getSession().isInteractive()



Script:



hideAttachments();



function hideAttachments(){


        var answer = 'sys_created_by=' + gs.getUserName();


        current.addEncodedQuery(answer);


}



EDIT: I just tested this, it works. Only problem is that users that doesn't have itil role will not be able to see attachment from others in the whole instance. Is this a problem? I'll think on how to fix this.


Thanks, Edwin!   This works perfectly!


Hi Edwin,



I came across this post and it fits our needs exactly.   Unfortunately when I created that business rule all attachments still showed to our ESS users.   Is there something I am overlooking?   I copied the code and condition just as you had it and tried to set the run conditions for both Before and After with Insert and Update selected.   Any help would be much appreciated.



Thanks,
Mike


Hi Michael,



It should be running before query. Have you tried that? Please let me know if it doesn't work.



Thanks