OOTB Incident table List Pre filter block editable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi
I am working on the Incident table. In my application we use Incident table for Tracking Issues when an end user submit from portal.
We have 2 different users
ITIL
ABC-ITIL
this ABC is a brand on company table and incident table
when ABC user logins and check for Incident table List,
ALL Incident- filter will be Brand = ABC
MY Open Incident - Filter will be Brand = ABC AND Active = true
The ABC User should not be able to edit the List filter and can apply additional filter.
I should not be able to Edit the existing pre filter.
I can able to add extra filters
I have written the Before Query Business rule still i as a ABC user able to edit the existing filter
I am able to click on ALL
The filter was removed manually
Expectation - The filter should be always with Brand = ABC, if i try to edit manually it should be disabled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Are Kaveri
Try with this:
- Navigate to System Definition > Business Rules and click New.
- Set the following configurations:
- Name: Enforce ABC User Incident Filtering
- Table: Incident
- When: Before
- Query: Checked
- Check the Advanced box.
- In the Condition field, add the following script to ensure it only applies to your ABC-ITIL users:
gs.getUser().hasRole('abc_itil') // replace with correct role name
Sanple Script:
(function executeRule(current, previous /*null when async*/) {
if (gs.hasRole('admin')) {
return;
}
var queryString = "company.name=ABC";
current.addEncodedQuery(queryString);
//OR try with current.addQuery('company', 'sys_id_of_abc_company');
})(current, previous);
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have written query rule but still i am able to click on All manually. The filter need to be there upto brand if we click on All also it should not allow.
this query BR didnot worked for my scenario.
even written read and write ACL no luck