- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 03:42 AM
Hi Everyone,
Hope everything is going good.
I have two icon link widgets, "create new incident" and "Create new Custom table record" and each redirects to different pages in service now instance. For example, Widget A directs to Create new Incident record page and Widget redirects to Create new Custom table record page. Now, I want to make these widgets visible to all the users irrespective of their role, but if user doesn't have role on custom table, then when he clicks on "create new custom table record" widget, then he needs to redirect to the catalog item in service portal.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 07:11 AM
Hello,
You have to clone and customize Icon Link to have this functionality,
In server script, add these lines
if(gs.hasRole("<role name>"))
{
var gr = $sp.getInstanceRecord();
data.href = $sp.getMenuHREF(gr);
}
else
{
data.href = "?id=sc_cat_item&sys_id=<sys-id of catalog item>";
}
Fill <role name> & <sys-id> as per your requirement.
Please mark helpful if it solves the purpose.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 07:39 AM
You can keep the other ones as-is, because they are working fine, right?
So let them be , it's only with HR case. Apply this customized widget for it only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 08:11 AM
I have used the same Custom icon link widget for both "create new student record" and create new Application form record which redirects to specific pages. So, inorder to write this scripts based on role, Can i give different icon link widgets to two tables by placing respective role in the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 09:40 AM
As per my understanding, you have another form which also requires this role based scenario ?
You want to apply same script to that also but with different role, right?
In this case, if role is different from u_student_user then you need to add this script in another Icon link widget otherwise it will conflict with previous one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 09:47 AM
Yes exactly, so for other other I create another cloned icon link widget and will write the script in that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 10:27 AM
Great!
Please mark helpful and accept the solution if everything works fine.