How can I get current form view in Service Portal?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2019 11:58 PM
I'm currently trying to get a form's view in Service Portal.
In the back-end using getView() works without a hitch, but it isn't accessible from the portal. g_form.getViewName() doesn't give JavaScript errors, but it always returns an empty string. I have also tried to get the "view" parameter from the URL directly, with no success.
Any help will be appreciated!
Thank you!
Xabi
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2019 03:51 AM
Hi,
Can you share the script which is giving it as empty?
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
‎06-07-2019 03:54 AM
Hi! Of course 🙂
var view = g_form.getViewName();
alert(view);
The JS alert displayed with these lines (in an onLoad Client Script) appears blank.
Thanks for your support!
Xabi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2019 04:01 AM
Hi,
Is there any view on that table?
Is this code showing up some view name on native UI
Mark Correct if this solves your issue and also mark 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
‎06-07-2019 04:08 AM
Hi,
Yes, there are views in that form, as that same code does return the active view's name when using the back-end.
I just need this same functionality on the Service Portal.
Thanks in advance!