- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2021 03:07 AM
I'm currently in the process of setting up Agent Workspace to allow users to work on Incidents. We have a number of custom client scripts that run on Incident that i need to configure to work correctly in workspace. Is there a way to determine which UI you are in? I know there is the GlideURI server-side api which i could use to pull apart the uri to determine i'm in workspace but was wondering if there is anything on the client-side i could use? window.location.href doesn't work in workspace either...
Solved! Go to Solution.
- Labels:
-
Agent Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2021 03:15 AM
Hi,
you can use the view name i.e. workspace to make client scripts run on workspace
OR
you can check URL
if it contains 'now/agent/workspace' then it's workspace and not native UI
var url = top.location.href;
if(url.indexOf('now/agent/workspace')){
// workspace
}
Regards
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-01-2021 03:15 AM
Hi,
you can use the view name i.e. workspace to make client scripts run on workspace
OR
you can check URL
if it contains 'now/agent/workspace' then it's workspace and not native UI
var url = top.location.href;
if(url.indexOf('now/agent/workspace')){
// workspace
}
Regards
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-01-2021 03:27 AM
Thanks. top.location.href works in workspace which is useful so i may use that and pull it apart to determine the view. With regards to your first point when you say I can use the view name, what do you mean? How would I determine the view I am in?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2021 03:40 AM
Hi,
we usually create view with name as "workspace" on the table.
then create workspace view rules to show that view in workspace
But you need not worry on all these;
you can use the top.location.href for your solution
Regards
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-01-2021 04:02 AM
Right ok using a view rule... So there's no ServiceNow provided API to determine which view or UI you are in on the client-side then? Thanks.