- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 07:22 AM
Hi everyone, good morning!
The URL is successfully rendering(image attachment), but it only needs to appear for a specific Role
(available to Managers if there is a link)
When the manager clicks on the link(url) will be directed to the specific folder
however, I've already created the query, (I don't know if it's right), but it's rendering several URLs on the page (img query example attachment).
Could anybody help me?! Please
Tks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 08:30 AM - edited 11-21-2022 08:30 AM
Try adding gs.hasRole() as below:
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 08:36 AM
Hello @Elton2 ,
you can add a condition in server and HTML script to display it for few roles
server script :
/*SERVER SCRIPT*/
var grDisplayURL = new GlideRecord('table_with_url_field');
grDisplayURL.addEncodedQuery('manager_roleDYNAMIC52635e963f510100a9ad2572f2b4874c^url_folderISNOTEMPTY');
grDisplayURL.query();
if(grDisplayURL.next()){
data.showURL=false;
if(gs.hasRole('your_role_name'))
{
data.showURL=true;
}
else
{
data.showURL=false;
}
data.display_url_folder = grDisplayURL.getDisplayValue('url_folder');
}
HTML:
<td class="link" >
<a href="{{options.link}}" target="{{options.target}}" data-toggle="tooltip" class="link-url-folder">
<div ng-if="data,showURL==true">
<span class="display-url-folder">{{data.display_url_folder}}</span>
</div>
</a>
Hope this helps
mark my answer correct if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 08:30 AM - edited 11-21-2022 08:30 AM
Try adding gs.hasRole() as below:
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 09:26 AM
Hi RaghavSh, good afternoon!
Its working,
Thanks so much!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 08:36 AM
Hello @Elton2 ,
you can add a condition in server and HTML script to display it for few roles
server script :
/*SERVER SCRIPT*/
var grDisplayURL = new GlideRecord('table_with_url_field');
grDisplayURL.addEncodedQuery('manager_roleDYNAMIC52635e963f510100a9ad2572f2b4874c^url_folderISNOTEMPTY');
grDisplayURL.query();
if(grDisplayURL.next()){
data.showURL=false;
if(gs.hasRole('your_role_name'))
{
data.showURL=true;
}
else
{
data.showURL=false;
}
data.display_url_folder = grDisplayURL.getDisplayValue('url_folder');
}
HTML:
<td class="link" >
<a href="{{options.link}}" target="{{options.target}}" data-toggle="tooltip" class="link-url-folder">
<div ng-if="data,showURL==true">
<span class="display-url-folder">{{data.display_url_folder}}</span>
</div>
</a>
Hope this helps
mark my answer correct if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 09:27 AM
Hi Mohith, good afternoon!!!
Its working too!
Thanks so much!!!