Can I detect from client script whether someone is using the Portal?

peterdelf
Giga Expert

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?

1 ACCEPTED SOLUTION

peterdelf
Giga Expert

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.Capture.PNG


View solution in original post

6 REPLIES 6

peterdelf
Giga Expert

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.Capture.PNG


The g_aw API is only availabe in Worspaces, so you can check for that.
 

 

 

 

 

if (typeof g_aw != 'undefined') {
console.log('workspace');
} else {
console.log('not in a workspace');
}