Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to hide attachments based on user role

chrish5
Giga Guru

I have a need to hide attachments on Stories from users with the scrum_reader role.   I have created the following onLoad client script on the rm_story table, but when I impersonate a user with the scrum_reader role, I am still seeing the attachment.   What am I missing?

 

function onLoad() {

if(g_user.hasRole('scrum_reader')) {

g_form.disableAttachments();

}

}

1 ACCEPTED SOLUTION

Omkar Mone
Mega Sage

Hi 

please try this in your client script.

gel('header_attachment').style.display='none';

 

Mark correct if it helps.

 

Regards,

Omkar Mone

www.dxsherpa.com

View solution in original post

5 REPLIES 5

I replaced g_form.disableAttachments(); with gel('header_attachment').style.display='none'; and this worked.   Thanks!