Display certain records in particular view

William08
Tera Contributor

Hi all,

 

I've a requirement to display some records in that particular view. Is there is a way to do that?

For example if incident has priority one then only the priority one incidents should be displayed in the "major incident" view on the list.

 

Thanks in advance

8 REPLIES 8

Peter Bodelier
Giga Sage

Hi @William08 

 

You can do this using view rules.

 

If you need additional help, let me know.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi Peter,

 

Thanks for the reply. I tried doing this but it didnt work out below is the scrrenshot am i missing anything here

William08_0-1704963588662.png

 

Hi @William08 

 

I think I misunderstood your question.
You want to filter the records based on the list view?

I'm not entirely sure that is possible, but you could try using a Query business rule:

Use as condition: 

global.RP.getReferringURL().indexOf('_list.do') >= 0

Use in the script (example):

var view_name='';
if (gs.getSession().isInteractive()) {
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
view_name= map.get('sysparm_view').toString(); //This contains view
}
}
        
if(view_name == 'major_incidents') {
       current.addQuery('priority', '1');
 }

 

However, it may be better to simply use a fixed query in the module, to show the right records.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi Peter this not working on the list is there anything i should take care off?