IT CanvassTalk to an advisor
Development · LessonBy , ServiceNow Architect · Published · Updated · current release · advanced

ServiceNow ACL scripting

Go beyond point-and-click security with scripted access-control conditions.

Quick answer

Access Control Rules (ACLs) decide who can read, write, create or delete a record or field. Most are configured with roles and conditions, but the real power comes from the script field: a snippet that returns answer = true/false for logic the UI can't express.

Key takeaways
  • How an ACL evaluates
  • Debugging access
  • Good habits
  • Try it Yourself

Access Control Rules (ACLs) decide who can read, write, create or delete a record or field. Most are configured with roles and conditions, but the real power comes from the script field: a snippet that returns answer = true/false for logic the UI can't express.

How an ACL evaluates

An operation is allowed only if all three gates pass: the condition, the role requirement, and the script. Any one returning false denies access. ACLs also cascade from field → record → table.

// Field-level ACL: only the assigned agent or a manager can edit var isAssignee = current.assigned_to == gs.getUserID(); var isManager = gs.hasRole('itil_admin'); answer = isAssignee || isManager;
Return via the answer variable. A scripted ACL communicates its verdict by setting answer (not return). Keep scripts fast and side-effect-free, they run on every record the user touches, so a slow ACL script is a platform-wide performance problem.

Debugging access

Use Debug Security Rules to see exactly which ACL granted or denied an operation, the fastest way to resolve 'Security constraints' errors. Remember: no matching ACL at all means deny by default.

Good habits

  • Prefer roles and conditions; reach for script only when necessary.
  • Never run heavy GlideRecord queries inside an ACL.
  • Test as a non-admin, admins bypass most ACLs.
Try it YourselfJavaScript
▸ Press Run to execute.

Runs in a sandbox in your browser. Mock gs and GlideRecord and sample data are provided.

Practice challenge

+0 XPStreak ×0
Question 1 of 3
A scripted ACL returns its verdict via...
Practise this on your own free instance.
Set up your free instance →
Already working on ServiceNow and stuck on a live ticket?Get an expert ServiceNow developer on screen-share to finish your daily tasks with you. Deliver on time, protect your reputation and your job. Monthly support only, no task-wise plans.Task assigned · no idea where to startStill stuck · your job on the lineExpert joins your screenDelivered on timeExplore On Job Support