How to show Reply/ReplyAll/Forward buttons on Incident table for a particular role/group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2023 03:22 AM
Hi All,
I have onLoad Client script to show Reply/ReplyAll/Forward buttons on Incident table , and also those buttons has to visible only for a particular role .
I have tried adding a if condition , but still buttons are visible for all logged in users, can any one please suggest what changes has to be made to achieve this requirement.
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_form.getTableName() != 'case' && g_form.getTableName() != 'management' && (g_form.getTableName() != 'incident' && (g_user.hasRoleExactly('major_incident_manager')))) {
$j('button[reply-type="reply"]').toggle();
$j('button[reply-type="replyAll"]').toggle();
$j('button[reply-type="forward"]').toggle();
}
}
Appreciate Your Response.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2023 04:04 AM
Hi @Neelavathi M ,
If you wish to control the visibility of UI actions based on roles, you can utilize the UI action condition field instead of employing a client script. Is there a particular reason for opting to use a client script in this scenario?
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2023 06:29 AM
Hi @Gunjan Kiratkar ,
Yes , those buttons are not usual buttons on the form, those are buttons on Email, buttons are restricted to used by only some tables , by making use of above Client script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2023 05:35 AM
@Neelavathi M - I would recommend to use script include function that would check if logged in user has particular roles and then you can use that function call in Condition field on UI action to check roles.
This would surely resolve your issue/concern.
Please Mark My Response as Correct/Helpful based on Impact
Thank You,
Rajesh Bhise