The workflow scratchpad is ServiceNow's solution to stateful data sharing across workflow activities. Unlike workflow variables which require formal definition and input/output mapping, the scratchpad lets you dynamically store and retrieve values using simple property assignment. Most developers initially try passing data through workflow variables or re-querying the record, but the scratchpad persists automatically across the entire workflow execution without additional database hits or complex variable mappings.
When to use this
- When you need to cache expensive lookups (manager chains, department calculations) for reuse in multiple activities
- When tracking original field values before workflow modifications for audit trails or rollback scenarios
- When conditional logic in later activities depends on calculations or decisions made in earlier activities
- When building approval chains dynamically where the sequence depends on business logic executed during workflow execution
When NOT to use this
- Don't use this for user-visible data β scratchpad values aren't accessible in catalog item forms or approval forms. Use formal workflow variables instead.
- Don't use this for cross-workflow communication β scratchpad scope is limited to a single workflow execution context. Use record fields or custom tables.
- Don't store large objects or binary data β scratchpad is serialized to the workflow context record and impacts performance with oversized payloads.
- Don't rely on scratchpad for error recovery β if the workflow fails and restarts, scratchpad data from failed execution isn't guaranteed to persist.
Key behaviors and gotchas
- Scratchpad persists automatically β you don't need to explicitly save it, but values are lost if the workflow engine restarts between activities
- GlideRecord objects can't be stored directly β you'll get
[object Object]back. Storesys_idvalues or usegetDisplayValue()for strings - Complex objects serialize as JSON internally, so functions and prototypes are stripped β stick to plain data structures
- Undefined scratchpad properties return
undefined, not null β usetypeofchecks or default values with|| - Scratchpad is workflow-instance specific β parallel workflows on the same record maintain separate scratchpad namespaces
- Values persist across workflow pause/resume cycles, making it reliable for long-running approval workflows with wait conditions
The scratchpad isn't accessible from subflows β values set in the parent workflow won't be visible in subflow activities. Pass critical data through subflow inputs or store on the record itself.
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros β scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.