How to detect user working on UI or Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
Hi All,
Kindly help me here,
gs.action.getGlideURI().toString().startsWith('api/now/sp'); in ServiceNow ,
will this code like detect Custom Portal ? how it detect custom portal(/abcdef)? when I open record, when I raise request from /abcdef portal.
or which is right way to identify
on Table Record - OnSubmit Client script - UI type : ALL
Isolated Script = True
I want to run set of code when user perform any activity (example : update Category = Hardwarre) in Portal , other different set of code when he perform same activity (example : update Category = Hardwarre) from UI .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
@Supriya25 You need to look for syslog_transaction table.
You need to watch on URL signatures like sp or /nav_to.do
Mark my response as helpful if it helped you.
Thanks,
Mahesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi ,
I didn't get you , why do we need syslog_transaction table?
I'm looking for the solution , there want to execute two different blocks of code from single OnSubmit client script.
I found some references already : https://www.servicenow.com/community/servicenow-ai-platform-forum/detect-user-working-in-ui-or-servi...
https://www.servicenow.com/community/developer-forum/how-to-script-if-serviceportal-client-script/m-...
in my case mine is not /sp OOB portal , my portal is Custom Portal /abcdef.
will this Window===null works for all types of Portals or Only OOB portal /sp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Supriya25 ,
If you need to run different logic in an OnSubmit Client Script depending on whether the user opened the form in the native UI or in a Service Portal (and your instance may have multiple custom portals), the simplest and most maintainable solution is to create two separate Client Scripts:
- Script 1: For native UI ->UI Type: Desktop
- Script 2: For Service Portal -> UI Type: Mobile / Service Portal
✔️ Why this approach?
- No complex detection logic inside the script.
- Each script runs only in its intended context.
- Easier to maintain and extend (especially if you add more portals later).
If this solution helps you then, mark it as accepted solution ✔️ and give thumbs up 👍!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
check this: https://www.servicenow.com/community/servicenow-ai-platform-forum/detect-user-working-in-ui-or-servi...
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/