Restricte the itil user to view the closed incident in list view

Arun_Manoj
Mega Sage

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 

3 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@Arun_Manoj 

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.

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

View solution in original post

Runjay Patel
Giga Sage

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

View solution in original post

Anand Kumar P
Giga Patron
Giga Patron

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

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Arun_Manoj 

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.

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

Runjay Patel
Giga Sage

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

Anand Kumar P
Giga Patron
Giga Patron

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

Ravi Chandra_K
Kilo Patron
Kilo Patron

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