
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2019 01:39 PM
I just created a simple onLoad script to check and set a form view on an Incident.
// Simple onLoad script
function onLoad() {
var view = getView().toString();
if(view == '') {
switchView('section','incident','mobile');
}
return;
}
My issue is that I didn't find any documentation for this. Does this mean that this is an un-supported, un-documented way to check and set form views?
And that it may go away at any time with future version updates?
If this is un-documented and volatile, what's the proper way, when using an onLoad script on the client side, to get and set a form view?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2019 01:46 PM
Checkout View Rules, Eric.
https://docs.servicenow.com/bundle/madrid-platform-user-interface/page/administer/navigation-and-ui/task/t_CreateAViewRule.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2020 05:23 AM
Hi Eric
You are correct because just like creating fields on a form if you give a field a Label of "CSP Team" the actual field name is csp_team.
I found that if you look at theSystem UI > Views you see 2 fields on a view, Title (like the Label on a field in a form) and Name (like name on a field) So, for views, Title is what you see in the Views list from the Hamburger menu where Name is how you reference the view in code.
Once I changed answer = 'CSP Team'; to answer = 'csp_team';
The view worked based on the group the user was in. The documentation seems to be using the Title instead of the name in their example in the Link you were given and even now in Orlando it is still there.