IT CanvassTalk to an advisor
Development · LessonBy , ServiceNow Architect · Published · ServiceNow · all levels

Scoped applications

Build in a scope: namespaces, cross scope access, restrictions and how scoped apps move between instances.

Quick answer

Build in a scope: namespaces, cross scope access, restrictions and how scoped apps move between instances.

Key takeaways
  • Scope is a boundary for tables, code and records
  • Cross scope privileges are explicit and auditable
  • gs.log is replaced by gs.info, gs.warn and gs.error
  • Scoped apps version and publish rather than travelling in update sets

Why scope exists

A scoped application owns its tables, scripts and records under a namespace such as x_acme_orders. Nothing outside the scope can read or write those artefacts unless the app publishes access, which prevents one team breaking another team work.

Cross scope access

When your code touches a table in another scope, the platform creates a cross scope privilege record that an admin approves. Global scope is not automatically open either, so plan the read and write permissions your app needs before go live rather than firefighting them.

What changes in scoped code

Several global conveniences are restricted.

  • gs.log is unavailable, use gs.info, gs.warn and gs.error
  • Direct access to some system tables requires an explicit privilege
  • GlideRecord queries honour ACLs by default when run in scoped scripts
  • Scripts run with the scope permissions, not the caller role set

Delivery

Scoped apps move as application files through the ServiceNow Store, a repository link, or a versioned application publish. That is cleaner than update sets and is one of the strongest reasons to build in scope.

Practice challenge

+0 XPStreak ×0
Question 1 of 2
What does a cross scope privilege record control?

Frequently asked questions

Should everything be built in scope?
New applications yes. Small process changes to shipped applications, such as an incident business rule, stay in global because they belong to that application.
Why is my scoped script failing to read a global table?
The table is not accessible to your scope. Grant the cross scope privilege, or expose a scriptable API from the owning application.
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