Forcing a particular view of a form

Jamsta1912
Tera Guru

Hello all,

I've created a module, 'List of Records' link type, that displays Incidents with a view called 'Live_INCs'. However when a user selects a record from the list I would like the Incident form to be displayed using the 'Default' view, rather than the view 'Live_INCs'.

I've found this global business rule:
http://wiki.servicenow.com/index.php?title=Restrict_Form_Views_by_Role

but I can't get this working for me. As far as I can see nothing would actually run in this business rule because all the code is wrapped in functions. I feel like I'm missing something obvious?

Is there a way of forcing a particular form view, from a different list view, either with or without the global business rule above?

Regards
Jamsta.

6 REPLIES 6

tomcamish
Kilo Contributor

Hi all,



i know this is an old post but this is how i did what you're trying to do:



  1. Go to System UI - Views and locate your view, in your case "Live_INCs".
  2. Scroll down to the "Forms" section (or tab depending on your settings) and ensure there is an entry for the Incident table listed.
  3. Do the same for the "Lists" section/tab.
  4. Click your module header again to view the list - as before you'll see that it has the view "Live_INCs". Click one of the records and you'll see that the view is still called "Live_INCs" but you'll be able to customise it as usual and it won't effect the list view.


The only issue i had from here was there were some fields i didnt want certain users to see so i just created a client script to make them invisible based on the roles.



Hope this helps.


Haritha Kotturi
Giga Contributor

Hello,

 

For List view:

You need to edit the module. There are fields called 

 
View name = your specified view name and Argument : &sysparm_view_forced = true
 
  
For form view:
 
You need to write view rules else it'll display based on user preferred view.