- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2018 07:32 AM
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();
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2018 07:37 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2018 07:36 AM
Hi Chris,
Did you try giving an alert to check whether it is going inside the if condition.
function onLoad() {
if(g_user.hasRole('scrum_reader')) {
alert("Inside has Role");
g_form.disableAttachments();
}
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2018 07:57 AM
I did and the alert appeared, so it was going inside the if condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 09:47 AM
Hi Ankur,
I have tried all possible functions in client side on a custom Scoped app table. Ensured the Isolate script in unchecked. Still the 'Manage Attachment' from the top of the form is not hidden. Any suggestions pls?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2018 07:37 AM
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