How to tell if user is using service portal or actual platform

Justin Dreher
Kilo Expert

Hi all,

In developing an order guide, it has been put on me to display alerts based on options chosen on the form. While this is very simple, an I had an idea. Basic JavaScript alerts in my opinion would take away from the aesthetic of the service portal, it has it's own alert system so why not use it? (I am referencing gs.info('message here');) Is there a way to check whether the user is using the service portal or the platform? My goal here is to use the basic JavaScript alerts for the platform, and the service portal alerts for the service portal, something like this.

if(using service_portal){

     gs.info('this is a message');

}else if(using platform_view){

     alert('this is also a message');

}

Thanks!

-Justin

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Justin,

If you want to check this in onLoad have this:

check if url contains /sp

check below links:

https://community.servicenow.com/community?id=community_question&sys_id=85e68fa5db1cdbc01dcaf3231f96198c

https://community.servicenow.com/community?id=community_question&sys_id=68e2bbd3dbecdb840e3dfb651f96192a

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Justin,

If you want to check this in onLoad have this:

check if url contains /sp

check below links:

https://community.servicenow.com/community?id=community_question&sys_id=85e68fa5db1cdbc01dcaf3231f96198c

https://community.servicenow.com/community?id=community_question&sys_id=68e2bbd3dbecdb840e3dfb651f96192a

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader