Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Set form view based on role

Patrick Slatter
Tera Guru

Morning! 

I am running into an issue with enforcing a view to users based on role. 

This seems to be due to it saving "user preferences"

I have a default view and a handful of custom views, for the demand records. 

 

If a user is on "business" view or "Finance Transformation" view in teh list and then opens a demand record, it should display in "FInance Transformation View".  There is a role "finance transformation" that users using both of these views have. 

I have a view rule in place 

(function overrideView(view, is_list) {
answer = view;

if (gs.hasRole("admin"))
return;

if (gs.hasRole("finance_transformation"))
answer = "Finance_Transformation";


})(view, is_list);

 

 

ISSUE:

If i am on finance transformation list view and open a record it works 

If i am on business view and open a record it opens in "Defautl view" 

 

How can i enforce both of these to open in finance transformation form view?

 

Thanks!!

1 REPLY 1

Patrick Slatter
Tera Guru

@BharathChintala any thoughts?