How to FORCE a UI View in a module

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2016 01:02 PM
We have a module on Change > Create New.
I would like to FORCE that module to ALWAYS open the create new form with the default view.
I edited the Application Menu and added the name of the view.
However, it does not work! If the user has another view (such as the approval view) open prior to clicking Create New, it stays with the previous view and does NOT force the default view.
I also tried sysparm_view=default
That did not work either.
How to force the view every time the module is open?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2017 06:57 AM
Have you taken a look at this article?
http://wiki.servicenow.com/index.php?title=Restrict_Form_Views_by_Role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2017 07:03 AM
Yes I used that template:
function sys_userGetViewName() {
if (view.startsWith("my_very"))
{return;}
// do not change view if it starts with sys_ (e.g. sys_ref_list)
if (view.startsWith("sys_"))
{return;}
answer = "my_very_speical_view";
}
function sys_user_listGetViewName() {
sys_userGetViewName();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2017 07:07 AM
Can you share what YOUR script looked like?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2017 04:14 AM
Hi Fuzumbrhan,
I'm facing the same issue. Could you please share the solution if you successfully found it ?
Thanks,
Amrit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2017 06:54 AM
For open tickets, to force users to the view you want you'd need to define
it on the module, then the list forces to that view and the records that
you view BUT the user can amend the view.
For new tickets, if you have a view name that is not default adding the
view name, with underscores for spaces, should do the trick, i.e.
sn_si_incident.do?sys_id=-1&sysparm_query=active=true&sysparm_view=
&sysparm_view_forced=true
Hope that helps
Dave