
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2017 09:16 AM
I'd like to add a UI Action which is only available from the normal ServiceNow view and not available if someone is using the Service Portal to view the form. I've had a look into seeing if I can determine the URL that someone is viewing the form with a URL starting '/SP/' but didn't get far. Anyone else got tips on how to do this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2017 02:34 AM
Actually I found out that this is far more simple than scripting. It appears that there is now a related list of 'UI Action Visibility' that allows me to configure point-and-click not to show this button on my Service Portal view. Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2017 09:23 AM
Hi Peter,
you can use the condition field in the UI action.
Call script include, get the browser window url search for specific text and return true or false and based on that the button will be shown.
getting url from server side, below will work in both scoped and non-scoped app
var windowUrl = gs.action.getGlideURI().toString();
Mark Correct if this solves your issue and also hit Like and 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
11-22-2017 09:26 AM
Hi Peter,
Sure. You can use window.location.href to retrieve the url and perform the respective comparison.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2017 09:27 AM
I hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2017 09:28 AM
Just in case, the following thread may also be helpful:
How to get entire URL in Client Script OR sysparm
Thanks,
Berny