The CreatorCon Call for Content is officially open! Get started here.

Is it possible to change the view and update the form via ACL?

SAS21
Tera Guru

For a specific role, can we create an ACL to change the view of the form ? 

1 ACCEPTED SOLUTION

Hi @SAS21,

 

Try this updated view rule scripts:

(function overrideView(view, is_list) {
	var role = gs.hasRole('x_sb_nw_bu_analyst');

	if (is_list && role) { // if it's a list and has required role
		answer = "vendor"; // set the new view to answer
	} else // if it's not a list, in other words, on a form
		answer = ""; // "" is for default view

})(view, is_list);

 

For your reference: KB0723494 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow

View solution in original post

5 REPLIES 5

Elijah Aromola
Mega Sage

You can add roles to UI Views that specify which roles can access that view.  

Sagar Pagar
Tera Patron

Hi @SAS21,

 

I would suggest to create a view rule on table with conditions instead of ACL.

Take a look at this docs: Create a view rule 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow

Hi @SAS21,

 

Have you look at my comments? Let me know if have any queries.

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow

Hi Sagar,

Yes, i tried this way but its not working when user tries to open record from a reference field info icon

(function overrideView(view, is_list) {

// Add your code here
var role = gs.hasRole('x_sb_nw_bu_analyst');
if (role) {
answer = 'vendor';
}
})(view, is_list);

 

Am i missing something ?  The requirement is the specified role open the record from reference fields - it goes to default view . Need to change that to vendor view

 

Thank you for your time