- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 11:13 PM
Hi,
Requirement is when the incident moved to closed state then itil user can't access the closed incident and it will invisible in the list view
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 11:32 PM
you can use table level READ ACL or update OOB query BR for this
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 11:35 PM
Hi @Arun_Manoj ,
create table level read acl and in condition select the itil role.
in script use below code.
// Only allow access to the record if the state is not closed
if (current.state == 'Closed') {
return false; // Deny access to the closed incidents
}
return true; // Allow access to other incidents
2nd approach is to write query business rule like below
Add conditions like state not equal to closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 11:41 PM
Hi @Arun_Manoj ,
Create query business rule :
Table: incident
When: Before
Query: Checked
2. Script:
(function executeRule(current, previous /*null when async*/){
if (gs.hasRole('itil')) {
current.addEncodedQuery('state!=7');
}
}
Acl:
Configure the following fields:
Type: Record
Operation: read
Name: incident (select from the table dropdown
Use the following script in the Script section of the ACL:
if (!gs.hasRole('itil')) {
return true;
}
if (current.state != '7') {
return true;
}
return false;
}
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 11:32 PM
you can use table level READ ACL or update OOB query BR for this
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 11:35 PM
Hi @Arun_Manoj ,
create table level read acl and in condition select the itil role.
in script use below code.
// Only allow access to the record if the state is not closed
if (current.state == 'Closed') {
return false; // Deny access to the closed incidents
}
return true; // Allow access to other incidents
2nd approach is to write query business rule like below
Add conditions like state not equal to closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 11:41 PM
Hi @Arun_Manoj ,
Create query business rule :
Table: incident
When: Before
Query: Checked
2. Script:
(function executeRule(current, previous /*null when async*/){
if (gs.hasRole('itil')) {
current.addEncodedQuery('state!=7');
}
}
Acl:
Configure the following fields:
Type: Record
Operation: read
Name: incident (select from the table dropdown
Use the following script in the Script section of the ACL:
if (!gs.hasRole('itil')) {
return true;
}
if (current.state != '7') {
return true;
}
return false;
}
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 11:51 PM
Hello @Arun_Manoj
You can achieve this with before query business rule which is better performance wise.
But wouldn't this requirement create confusion to ITIL users in future? They need to see the closed cases generally..?
Kind regards,
Ravi Chandra