Force A View From A Module

Views in ServiceNow are a very useful tool, but there are a lot of little ‘gotchas’ you need to be aware of.

One of these is using the ‘View’ field when creating a module. The expected behaviour is simple, you enter for example the ess view, you’d expect whenever the module was clicked, the ess view would be displayed.

Not exactly how it works though! The video attached shows this in action… The first time you select the module, it’ll select the view you entered into the module. But, if you manually change the view, it will remember this and even the next time the user clicks this module, it’ll use the view which you changed to rather than the view that you selected!

A simple argument to the URL can resolve this issue, and force the view to be what you selected it as.
Note: sysparm_view does NOT work and sysparm_force_view only allows one view to be selectable which isn’t what we’re looking for.

So, the answer? Simply add these details to the arguments:

sysparm_userpref.incident_list.view=ess&sysparm_userpref.incident.view=Major Incidents

replace ‘incident’ with the table you’re displaying and change the views to the views you actually want. You may have noticed that there’s two arguments in that list. Interestingly, it allows you to force a different view for the list view and the form view.

Another point that I noticed, which seems a bit of a bug to me, but if there is no conditions on the query on the table (for example on the ‘All’ module within incidents application), it will set the arguments above as the query! Simple workaround for this is add a & to the beginning of the arguments.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.