Domain separation changes what a developer has to get right. Scripts should reference the sys_domain field rather than domain paths, queries are narrowed to the domains a user can reach before results return, and the domain log shows when the hierarchy has drifted. For the concepts behind these habits, read domain separation explained.
Activate the plugin early, ideally before other plugins are enabled
The separation plugin depends on a companion installer, Domain Support – Domain Extensions Installer, which must be requested before the main plugin is activated. The installer’s identifier is com.glide.domain.msp_extensions.installer, and the separation plugin is com.snc.pa.domain_support. Activate them at the start of development, ahead of other plugins, because late activation carries real risk.
Once the plugin is on, the sys_domain column appears on the task table and existing records are placed in the global domain. Much of the platform’s own logic also lives in global, including business rules, client scripts, form views and workflows. Moving records into their correct domains by script requires an established parent and child hierarchy, and a mistake at that stage can corrupt or lose data or cause downtime while large volumes move.
Separation itself rests on the Domain table, sys_domain. Each domain can carry its own delegated administration and policy, and records start life in global. When a user views or acts on a record in another domain, the user’s current domain determines how that happens.
Write scripts that survive a hierarchy change
Domain paths are calculated from where a domain sits in the hierarchy. Move a domain and its path recalculates, so a script that hard-codes a path can stop matching records, throw errors or break. Write scripts against the sys_domain field, not against domain paths. The base system business rules that use sys_domain are a practical pattern to study before writing your own.
Two details are easy to miss. The platform does not capture sys_domain_path values in an update set, because hierarchies differ between instances. After importing an update set, validate the domain hierarchy and confirm that the path values on your records are correct. Second, scripts in a separated instance need the same discipline as any other code. Prefer server-side scripting, restrict client scripts to ServiceNow APIs, limit synchronous calls back to the server, and put code changes through peer review.
Understand how queries are filtered
When a user opens a list, the platform appends a WHERE clause to the query. That clause limits returned records to those in the user’s domain or in the domains the user may access. Contextual security then narrows the result further. For a separate explainer on access control lists, see access control lists explained.
Domain paths are the default query method on instances with domain separation enabled. They outperform the older approaches of domain spooling on sys_domain and domain numbering. To confirm which method an instance uses, check two system properties. When domain paths is active, glide.sys.domain.provider is set to domain_paths and glide.sys.domain.paths.installed is true. When it is not, the provider is something other than domain_paths and the installed flag is false.
Use contains relationships sparingly
A contains relationship lets one domain see another domain’s records. It is many-to-many, and it does not change how a process flows. The trouble lies in the query it generates. Each contains relationship adds an OR condition, and broad access or a large number of relationships produces queries full of them. OR conditions are slow and affect the performance of the instance.
Treat contains as an exception, reserved for cases where users or groups must see data from a domain they cannot otherwise reach and moving them is not an option. Confirm the access is genuinely needed before granting it. If a domain contains a domain that is itself the parent of several others, the OR conditions multiply quickly. Designing the hierarchy so that visibility flows through parent domains tends to keep queries simpler than a web of contains links.
Domain-separate a custom table
Separation suits some tables better than others. If a table belongs to the base instance and has no sys_domain field, leave it that way.
When you do separate a custom table, create a field of the domain_id type and name the column sys_domain. That name is reserved, so the platform recognizes it and applies the correct field type and attributes automatically, and it creates a sys_domain_path field alongside. Set the column name to sys_domain, not the label.
Without a business rule, a new record takes the domain of the user who creates it. Custom tables usually need logic that assigns the domain deliberately, typically from the Company field. The task table’s rules show the pattern, and their order matters.
| Business rule on the task table | Role | When it runs |
|---|---|---|
| Domain – Set Domain – Task | Sets the domain from the company’s domain | First, by the Order field (lowest value first) |
| Domain – Default – Task | Moves records without a domain into the default domain | Next, if the first rule has not assigned a domain |
| Domain – Cascade Domain – Task | Carries a task’s new domain over to related records | When the task’s domain changes |
If the initial rule fails to set a domain, a fallback can examine the task_for field, which is populated from the caller or the requested_for field. If task_for is set, the record takes the user’s domain. Otherwise it goes to the default domain.
The cascade rule reaches beyond the task itself. Related records such as workflow context, workflow history, approver tables, attachments and emails must move with the task. If they do not, they disappear from view for users in the new domain. The cascade is commonly triggered when records are cleared out of the default domain.
Read the domain log when paths go wrong
Domain problems leave a trail in the Domain Log table, syslog_domain. When the domain hierarchy changes, the platform schedules a job that recalculates domain paths, and the log table records the outcome. Review that table for errors and warnings after any hierarchy change. The example log shows ten orphan records in the sys_ui_list table, and those records must be fixed before the domain path calculation can complete.
Read the log, fix the records it names, then run the domain path validator again.
Check the properties that shape behavior
Several system properties control how separation behaves. Two deserve attention before you build on the platform.
| Property | Setting | What it controls |
|---|---|---|
| glide.sys.domain.include_domain_condition_on_join | true (recommended value when the separation plugin is active; no default is set, and the fallback is false) | Adds domain conditions to join queries so dot-walked fields respect separation |
| glide.ui.domain_reference_picker.enabled | true, in Core UI | Searches domains as you type rather than loading the whole list |
The join property is a safe-harbor setting. Once it is changed, it cannot be reverted. Test the change in a non-production environment first. The picker property is set in System Properties (sys_properties.list), followed by a browser refresh.
Do not upload more than 30 domains at once through an integration or import set without testing first, since that can bring an instance down.
Keep the domain picker fast
The number of domains does not slow an instance on its own. What matters is what each domain carries. Domains loaded with many properties add weight, and if the full list is loaded, the picker must finish loading everything before the user gains control of the session. In an extreme case, users may be unable to reach anything on the instance until it finishes.
Before creating a new domain, open Domain Admin, then the Domain Map, and check whether an existing hierarchy can do the job. After any extended time away from an instance, reload the domain list completely. A session that times out falls back to the domain on the user record and drops elevated roles, but the picker can still show the last domain you selected until the list reloads.
Keep configuration inside a tight margin
Favor standard features and configurable options when planning changes. Each one-off change adds margin for error. Before changing something, decide whether it belongs in a global setting or a configurable property, and let variation come through properties that apply automatically to each customer.
Start with the base system features and verify any gaps before building anything, and look for no-code solutions first.
Company-level customization has its own boundaries. Themes and logos can be set per company on the company record. By default, core business rules set a record’s domain to its company’s domain. Tables such as User, Group, Location and Department let you override that domain at creation, but the Task table does not.
Frequently asked questions
Should a script ever use a domain path?
Avoid it. Paths recalculate whenever the hierarchy changes, so a script that depends on one can stop matching records or fail. Reference the sys_domain field instead.
What happens to existing records when the plugin is enabled?
Existing records are placed in the global domain, and much of the platform’s own logic lands there too. Assigning records to their correct domains needs an established parent and child hierarchy, so plan the hierarchy before activation rather than after.
Why did query performance drop after I added contains relationships?
Each contains relationship adds OR conditions to the queries that run against the domain, and broad or nested access multiplies them. Reduce the number of relationships and redesign the hierarchy so that visibility flows through parent domains.
What should I check after importing an update set?
Validate the domain hierarchy, because sys_domain_path values are not carried in update sets. Then confirm that the path values on your imported records are correct.