Service-now allows administrators a lot of flexibility in defining which elements appear on a particular form or list. The set of fields and related lists that appear are collectively defined as a View. One common configuration task is to somehow limit access to a particular view based on a user role or some information on the record being viewed. Instructions for working in some of these scenarios can be found here…

View Rules
Restricting Form Views by Role

Neither of these methods work if you need to change the view of a form from a client script or a UI action. In order to do that, you can call the ‘switchView’ function as follows…


The table and view parameters should be self explanatory. The ‘type’ parameter is either ‘list’ (to redirect to a list view) or ‘section’ (to change to a form view). Here’s an example client script that shows how you could use ‘switchView’ to change the incident form view to ‘ess’ if the ‘Category’ field changed to a value of ‘hardware’.

One thing to keep in mind when using this function is that the form HAS to reload in order to change the form view. This means that the system will attempt to save the record before moving from one view to another.
function onChange(control, oldValue, newValue, isLoading) {
   //If the page isn't loading
      //If the new value isn't blank
      if(newValue != ''){
         //Change to the 'ess' view if the Category is 'Hardware'
         if(newValue == 'hardware'){