Define roles in Custom App

kavitha_cr
Mega Guru

Hi All,

 

Requirement: I have created a new custom app called "PeopleNow" and created a new table called "GB Case" which is extended from Task table and created few record producers using this table.

Here, there are three categories of users who use this application. 

1. Requesters(who raise the GB Cases using the Record producer. Also, here - Person A should not be able to see the Person B or other requests or GB Cases)

2. Fulfiller(whom the GB Cases gets assigned to)

3.Admin(Developer)

 

Can anyone guide me how can the above roles be managed efficiently in the custom app and the custom table.

 

Thanks & Regards,

Siva Jyothi.

 

1 ACCEPTED SOLUTION

@kavitha_cr Please check if there is already a * ACL present on the table. which is blocking access to the fields. If yes then you also create * ACLs same as we created table.None ACLs

 

And you must add the below script in CREATE/READ/WRITE ACL

 

answer = (gs.getUserID() == current.<REQUESTED FOR FIELD NAME HERE>.toString()) || (gs.getUserID() == current.<ASSIGNED FIELD NAME HERE>.toString()) || (gs.getUserName() == current.sys_created_by.toString());
 
Please mark as correct answer if this solves your issue.
Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

View solution in original post

6 REPLIES 6

Community Alums
Not applicable

Hi @kavitha_cr ,

When you create a custom app, you are provided the option of several things happening at once to make it easier to get started.

 

  • A scope is created
  • A table is created
  • A role is created
  • Default read/write/create/delete ACLs are created

You have to provide the role to the application either by creating ACL's or by going to System definition->Application Menus or you can right click on the application and edit the application menu.

 

I suspect your users don't have the rights/access/roles to access the data in that table. Start by manually granting one of them the role associated with that table. You can see this if you go to Configure> Table and look for the Role field. If that works, you know it's ACL related and can work from there.

jaheerhattiwale
Mega Sage
Mega Sage

@kavitha_cr 

Create 2 new roles.

1. Admin

2. User

 

Create below ACLs on table

1. 2 ACLs of type CREATE

    One for Admin

    One for User - in this add the script - if the logged in user is Assigned To user or Created By user then only allow access

 

2. 2 ACLs of type READ

    One for Admin

    One for User - in this add the script - if the logged in user is Assigned To user or Created By user then only allow access

 

3. 2 ACLs of type WRITE

    One for Admin

    One for User - in this add the script - if the logged in user is Assigned To user or Created By user then only allow access

 

4. 1 ACL of type DELETE

    Allow Admin

 

Give Admin user the Admin role.

Give full filler and requestor the User role.

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Hi @jaheerhattiwale ,

 

Thanks for the response.

 

I have created the ACL's like below:

For create, I haven't written any code as user should be able to create the ticket, but when the user click on the new, no fields are visible. The ACL is below.

SivaJyothi1_0-1670829145963.png

All the users with the user role should be able to create the GBS ticket but they should be able to see only the tickets if the logged in user is requested for, assigned to or created by. 

Can you please elaborate what should be the ACL type and it is  none or *.

 

Thanks in  Advance,

Siva.

@kavitha_cr Please check if there is already a * ACL present on the table. which is blocking access to the fields. If yes then you also create * ACLs same as we created table.None ACLs

 

And you must add the below script in CREATE/READ/WRITE ACL

 

answer = (gs.getUserID() == current.<REQUESTED FOR FIELD NAME HERE>.toString()) || (gs.getUserID() == current.<ASSIGNED FIELD NAME HERE>.toString()) || (gs.getUserName() == current.sys_created_by.toString());
 
Please mark as correct answer if this solves your issue.
Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023