List View 'ALL' restriction

Vengeful
Mega Sage

We received a requirement that when risk user click the ALL in the list view, it should restrict them so view all the Risks created by other risk users.

Vengeful_0-1738725935467.png

Currently, this is the My Risks menu

Vengeful_1-1738726002139.png

 

When they clicked ALL, they see all the risks

Vengeful_2-1738726069799.png

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Vengeful 

the only way to handle this is creating query business rule on your table. Ensure if you have OOB query business rule on sn_risk_risk table then you add/modify code for that.

When they click they should see risks created by other user and not themselves?

Condition: gs.getSession().isInteractive()

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	current.addQuery('owner', '!=', gs.getUserID());

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Chaitanya ILCR
Kilo Patron

Hi @Vengeful ,

1. you can create a query business rule to restrict the users from seeing the other records.

2. you can update the module and add sysparm_fixed_query this way users will not be able to click on all 

ChaitanyaILCR_0-1738729522747.png

but they can still be able to see all the record if query business rule or ACL is not implemented.

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Vengeful 

the only way to handle this is creating query business rule on your table. Ensure if you have OOB query business rule on sn_risk_risk table then you add/modify code for that.

When they click they should see risks created by other user and not themselves?

Condition: gs.getSession().isInteractive()

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	current.addQuery('owner', '!=', gs.getUserID());

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader