Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to restrict read access to few fields on HR case table for a service account?

sagarika11
Tera Contributor

Hi,

 

We have a requirement to create a scripted rest API to read HR case data and return case number, created, updated , state and HR Service field values in the response.

This has been successfully implemented.

However we have additional requirement that the Service account which is used to call the scripted rest api should read the above fields , Service Account should not have read access to other fields.

 

Tried to create a custom role, adding a new coe security policy, new ACLs. But it does not give service account enough permission to read the fields.

 

Can you help with the best way to achieve this restriction?

3 REPLIES 3

Rafael Batistot
Kilo Patron

Hi @sagarika11 

 

Use a dedicated role + ACLs.

  • Create a role specifically for the integration account.
  • Give the account only this role.
  • Create table-level read ACL for the HR Case table.
  • Create field-level read ACLs only for number, sys_created_on, sys_updated_on, state, and hr_service.
  • Ensure the account has no inherited roles providing broader HR Case access.
  • Keep the Scripted REST API restricted to this role.

If HRSD COE Security Policies are blocking access, they also need to be aligned. The important point is that field ACLs alone don’t grant table access.

 

https://ikconsulting.com/post/best-practices-for-making-fields-read-only-in-servicenow

 

If this response was helpful, please mark it as Helpful and, if applicable, as Correct.
This helps other users find accurate and useful information more easily

Ankur Bawiskar
Tera Patron

@sagarika11 

my thoughts

-> Enable ACL enforcement on the Scripted REST API resource:

-> Create a custom role (e.g., hr_case_limited_reader) and assign it only to the service account.

-> Configure a COE Security Policy for sn_hr_core_case:

  • Grant Read access only to: number, sys_created_on, sys_updated_on, state, hr_service.

  • Associate the custom role with this policy

-> Add field-level ACLs as a safety net and add your custom role their

-> Avoid broad table-level read ACLs for this role—field ACLs only work if table access is granted, but shouldn’t expose extra fields.

Also check this KB, KB3144199 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Hi Ankur,

 

I tried this , but it does not help.

 

I have added the coe security policy as below:

SagarikaSwain_0-1787755190595.png

The group has the custom role added and service account is part of this group.

 

Below ACLs are added.

SagarikaSwain_1-1787755360932.pngSagarikaSwain_2-1787755397369.png

While logging in as the Service account, I am expecting this configuration should display 'number' field in HR case table, however I see an empty table.

SagarikaSwain_3-1787755597918.png