- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
We recently implemented Vault Data Privacy anonymization for a customer, masking PII (Social Security numbers, dates of birth, card and bank numbers, and so on) on task records with a set of data patterns. Short fields worked well. Long comments and work notes did not, and it took two Support cases to understand why. This post covers what we found, what ServiceNow Support told us, and how we're handling it, in case you're planning something similar.
Why long journal entries exist at all
The value field on sys_journal_field (where comments and work notes are stored) has a dictionary max_length of 8,000. But per KB0685779, max_length isn't enforced as a character limit for these fields, and comments and work notes are intentionally not truncated. Entries well over 8,000 characters are common, mostly from:
- inbound emails added as comments, especially long reply chains;
- email threads pasted into the Classic UI or Service Portal;
- integrations and scripts.
(The Workspace composer stops at 4,000 characters, so you won't reproduce this from Workspace.) In our instance the longest entry in a six-month sample was over 22,000 characters.
Limitation 1: Real-Time Anonymization has a 10 ms time limit
Real-time masking scans a field as it's saved. If the scan doesn't finish in time, the value is saved unmasked and the system log shows:
DataPrivacy exception while performing real time anonymization of data.
The API execution did not complete within the specified time limit.
Support confirmed:
- The limit is hardcoded at 10 ms, isn't configurable, and raising it is strongly discouraged because of the impact on save latency.
- Failures are recorded in
dp_rta_failure, but that table is only flushed every 30 minutes. If you check right after a test save, it looks empty. (We initially reported this as "failures aren't logged", which was wrong.)
In our tests with about 30 active patterns, entries of roughly 8,700 characters consistently timed out. We also saw occasional timeouts on short fields such as short descriptions, so treat real-time masking as best-effort rather than guaranteed. Many dp_rta_failure rows also don't identify the record, so you can't simply re-mask from that table.
Limitation 2: Anonymization jobs skip values longer than the column's max_length
When an anonymization job (De-Identify) includes comments or work notes, every entry over 8,000 characters fails with:
Skipped anonymizing data as the length of anonymized value exceeded the column size by N characters.
Anonymization technique applied was Data Pattern Anonymization.
A few things we noticed:
- N is always the entry length minus 8,000. The job compares against the dictionary
max_length, even though the platform already stores the longer value. - It happens for every long entry, including ones with no pattern match. In our pilot, none of the 84 long entries contained PII, yet 80 were reported as failures.
- The job summary only says "Anonymization failed for N records due to runtime errors", so you need the system log to see the cause.
- On a full run, each work item gave up after 10 of these skips, and the whole job stopped after 3 failed work items. A full-instance run couldn't complete with journal fields in scope.
Support's explanation: this is expected. The job won't write a value longer than the column's max length, because some masking techniques can make the value longer and the job can't risk truncating data.
What Support recommended
| Issue | Recommendation |
|---|---|
| Real-time timeout | Review your active data patterns and remove any you don't need, so scans are faster. Run an anonymization job on the same tables and columns to catch whatever real-time masking misses. |
| Job skips long entries | Increase the max_length of sys_journal_field.value to a value large enough for the longest data you expect. The job can then process those entries. |
How we're handling it
1. Interim: a scripted sweep for long entries (sub-production)
While we worked through Support, we used a script include and a scheduled job to mask PII in long comments and work notes. It:
- uses the same active data patterns as real-time masking (read from
sn_data_discovery_active_data_pattern); - scans with
sn_data_discovery_api.DataDiscoveryScanner, which returns match offsets (it's marked deprecated in favour of the channel-based API, but the newer API doesn't give positions); - replaces only the matched characters with
x, keeping the length the same, to match "Selective Replace with x"; - saves with
setWorkflow(false)andautoSysFields(false), so there are no notifications or updated-date changes; - deletes the parent record's cached
sys_history_set, so the activity stream rebuilds from the masked text; - logs only counts, record numbers and pattern names, never the values.
// core of the masking step
var found = scanner.scan(text); // JSON with findings and start/end offsets
spans.forEach(function (s) {
for (var i = s[0]; i < s[1]; i++)
if (!/\s/.test(chars[i])) chars[i] = 'x';
});
Tips if you try something similar: scan very long text in overlapping chunks; the scripted scan is fast (about 19 ms for 8,600 characters), so the real-time timeout isn't just pattern cost; and if you run the backfill in Scripts - Background, the scanner's deprecation warning can hit the 200,000 log statements per transaction limit and suppress your summary output. Check the rollback context's change count to confirm the results.
2. Long term: built-in functionality only
Our plan, pending confirmation from Support and approval from the customer:
- Raise
sys_journal_field.valuemax_length. The column already holds the longer values, so this should only align the dictionary with what's stored. Before changing it we're confirming with Support that it's metadata-only (no table rebuild on a very large table), that it's compatible with column-level encryption on that field, and how upgrades treat it. We'll size the value from the longest existing entry and test on Dev first. - Schedule a recurring anonymization job on comments and work notes (and the other classified fields) as the backstop for real-time masking.
- Retire the custom script once the recurring job is proven.
One risk no job can fix
Notifications go out as soon as a comment or work note is saved. If real-time masking times out, the email already contains the unmasked text, and no later job or script can change an email that's been sent. If that matters for your use case, review which notifications include journal content.
Checklist before you anonymize journal fields
- Find your longest comments and work notes. If any are over 8,000 characters, plan for the job limitation.
- Keep the active pattern list lean, and prefer keyword-qualified patterns to cut false positives and scan time.
- Test real-time masking with long synthetic text, and check
dp_rta_failureat least 30 minutes later. - Plan a scheduled anonymization job from the start rather than relying on real-time masking alone.
- Pilot the existing-data job on a date window before a full run, and read the system log, not just the job summary.
Have you run into this, or found another approach? I'd love to hear how others are handling long journal entries with Vault.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.