How to enforce a view in Problem Form without using View Rules

Aying
Tera Contributor

Hi,
We have a requirement to use different view (Instead of Default) for different users in Problem Form. Users should also be restricted from switching views as views. We used View Rules to implement this. However, the Modals on problem Form also enforced the view because of the view Rule. 

Aying_0-1720174652041.png


Any Idea on how we can fix this or enforce a view without using View Rule, so that Modals won't have issues?

1 ACCEPTED SOLUTION

The page displayed in the popup has sysparm_is_dialog_form=true parameter in the URL, which you can make use of in the script of your view rule:

(function overrideView(view, is_list) {

    if (gs.action.getGlideURI().getMap().get('sysparm_is_dialog_form') != 'true')
        answer = 'my_custom_view_for_problems';

})(view, is_list);

View solution in original post

6 REPLIES 6

Slava Savitsky
Giga Sage

What does your view rule look like?

Hi Slava. Below is my View Rule. However, whenever we apply this, the modals on Problem Form shows the whole Problem View Form as well.

View Rule:

Aying_0-1720401892740.png

 


Issue on Modal:

Aying_1-1720403997020.png

 

The page displayed in the popup has sysparm_is_dialog_form=true parameter in the URL, which you can make use of in the script of your view rule:

(function overrideView(view, is_list) {

    if (gs.action.getGlideURI().getMap().get('sysparm_is_dialog_form') != 'true')
        answer = 'my_custom_view_for_problems';

})(view, is_list);

Hi Slava,

This worked. 

 

We added the script on our View Rule and it no longer shows the whole View Form on our Modals. Appreciate the help!