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

ACL to see all the records created by myteam members

Ak8977
Tera Expert

Hello all,
I would like to create an ACL  to see all the records created by one of my team members. Could anyone help me on this.
thanks,
note -  user don't have itil role.

3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@Ak8977 What do you mean by your team members? Are you the manager of those users records in sys_user table?

hello @Sandeep Rajput , @Yashsvi .
let's assume I am member of A, B, C groups.

if a member from any group created an incident. I would like to see that incident.
actually if we don't have itil role we are only able to see incident created by me and requsted for me and assigned to one of my groups. But now I would like to see the tickets created by my team also.
thanks,

 

Yashsvi
Kilo Sage

Hi @Ak8977,

To create an Access Control List (ACL) in ServiceNow that allows users to see all records created by their team members, you'll need to set up the appropriate ACL rules and possibly script logic to define the conditions for viewing the records. Here’s a step-by-step guide to accomplish this:

Step 1: Identify the Table

Determine which table you want to apply the ACL to (e.g., `incident`, `task`, etc.).

Step 2: Create the ACL

1. Navigate to ACL Management: 

   - Go to System Security > Access Control (ACL)

2. Create a New ACL:

   - Click New to create a new ACL.

3. Define the ACL Properties: 

   - Type: Record

   - Operation: Read

   - Name: Choose the table (e.g., `incident`)

   - Requires Role: Select the roles that need this ACL (e.g., `itil`).

4. Condition and Script:

   - Define a condition or use a script to ensure the ACL applies only to records created by team members. For a more dynamic approach, you might use a script.

Step 3: Write the Script

1. Script: In the Advanced section, write a script to check if the record was created by a team member. Assume your team members are identified by a specific attribute, such as being part of the same group.

Script:

 

// Get the current user's sys_id
var currentUser = gs.getUserID();
// Get the group of the current user
var userGR = new GlideRecord('sys_user');
userGR.get(currentUser);
var userGroup = userGR.getValue('u_team'); // assuming 'u_team' is the field storing the team/group informatio
// Get the group of the record creator
var createdByGR = new GlideRecord('sys_user');
createdByGR.get(current.created_by);
var createdByGroup = createdByGR.getValue('u_team');
// Check if the groups match
answer = (userGroup == createdByGroup);

 

Step 4: Save and test the ACL

1. Save: Save your new ACL rule.

2. Test: Log in as different users and verify that the ACL works as expected, allowing users to see records created by their team members.

 

By following these steps, you can create an ACL in ServiceNow that allows users to view records created by their team members, enhancing collaboration and visibility within the team.

 

Thank you, please make helpful if you accept the solution.