- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 03:07 AM - edited 02-01-2024 03:16 AM
As per client requirement, we added 'Favorite requests' and 'Watchlisted requests' choices along with OOTB 'Open requests' and 'Closed requests'. We would like to show 'Watchlisted requests' option only if logged in user has 'sn_customerservice.case_viewer' role.
Any help on how to show/ hide a choice based on logged user role will be appreciated. Please find attachments.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 05:32 AM
Hello Guruvendra,
since the "My Requests widget" is probably a cloned version so that you could add your "Watchlisted requests" Choice you can add a data attribute to the Server Script to check if the user has the required role such as
data.hasCaseViewerRole = gs.hasRole("sn_customerservice.case_viewer");
and use that in your Body HTML Template to change the line from
<option value="watchlist">{{::data.messages.watchlistedRequests}}</option>
to
<option ng-if="::data.hasCaseViewerRole" value="watchlist">{{::data.messages.watchlistedRequests}}</option>
which will change the behavior so that the option for watchlist is only offered if the user has the sn_customerservice.case_viewer role. (or the admin role)
I hope that solves your Problem!
Best Regards
Dominik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 05:32 AM
Hello Guruvendra,
since the "My Requests widget" is probably a cloned version so that you could add your "Watchlisted requests" Choice you can add a data attribute to the Server Script to check if the user has the required role such as
data.hasCaseViewerRole = gs.hasRole("sn_customerservice.case_viewer");
and use that in your Body HTML Template to change the line from
<option value="watchlist">{{::data.messages.watchlistedRequests}}</option>
to
<option ng-if="::data.hasCaseViewerRole" value="watchlist">{{::data.messages.watchlistedRequests}}</option>
which will change the behavior so that the option for watchlist is only offered if the user has the sn_customerservice.case_viewer role. (or the admin role)
I hope that solves your Problem!
Best Regards
Dominik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 09:49 PM
Hi Dominik,
Your response helped me in my requirement. Thank you so much.