OBLYTECH Logo
OBLYTECH Logo

Offline Mode in ServiceNow Mobile Apps: Caching and Sync

Offline mode lets a ServiceNow mobile app keep working without a network connection. Administrators turn it on and choose which screens and data reach the device. The cache refreshes on a schedule, through background incremental updates, after a button action, or by hand. Changes made offline wait in an outbox and sync when the device reconnects.

Turning offline mode on for an app

Offline mode is delivered by the Offline Mode plugin, which supplies the flags, properties and interface elements used throughout setup. Installing it turns offline capability on for all users by default. If the Field Service Mobile plugin is already installed, the Offline Mode plugin comes with it.

Once the plugin is in place, the mobile app shows an Offline mode section in its Settings tab, where users download the cache. After a manual download, offline mode does not switch on by itself. The user selects it in the Offline settings, which can be done before entering an area with limited or no network access.

Admins configure this in Mobile App Builder under All > System Mobile > Mobile App Builder. On the mobile app configuration record, Offline enabled is toggled under Settings. Individual screens are then marked as available offline. The offline setup task lists the mobile_admin and admin roles as required. The security and access design work should settle who holds those roles before rollout.

Access can be narrowed with glide.sg.offline.roles, a comma-separated list of roles allowed to work offline. When it is empty, all users may use offline mode. Cached data also expires. glide.sg.offline.expiration defaults to 172800 seconds (48 hours), after which the device deletes the cache. Setting glide.sg.offline.enabled to false switches offline functionality off for the whole instance. For the rest of the mobile setup, see the mobile experience hub.

Choosing how the cache refreshes

Mobile apps offer four refresh methods. They can run alone or together.

Refresh method What it does Typical fit
Scheduled Downloads data at defined intervals, such as once a day, at the times set in the work schedule Predictable refresh ahead of a working day
Incremental Downloads changes since the last sync, in the background Frequent small updates with low bandwidth use
Button-triggered Refreshes the cache after the assigned write-back action succeeds Fewer chances of working from outdated records
Manual The user downloads or refreshes on demand Preparing before entering an area with no signal

Manual refresh works best as a backstop. Frequent manual downloads add server load, so regular manual downloads should be avoided, and scheduled and incremental updates are the suggested alternative. Once a cache exists, the app keeps updating it while online, whichever method started the download.

Button-triggered refresh is configured under Functions in Mobile App Builder. The function’s Type must be Action item. A button attribute named trigger_offline_cache_download then takes true to enable the refresh, false to disable it, or a blank value for the default.

Scheduled caching for field work

Scheduled caching follows the work schedule. The Agent Schedule plugin (com.snc.agent_schedule) must be active first. For Mobile Agent, the schedule entry is created when that plugin activates, and work schedules are added in the Agent Work Schedules table. Background jobs turn those into daily entries in the Agent Daily Schedules table. Each agent then receives a silent push at some point in the scheduled day. For the wider concept, see agent schedules.

Other mobile clients need an entry in the offline download schedule table (sys_sg_offline_download_schedule) for their client type, such as Request. A scheduler script can populate per-user schedules, as Field Service Mobile does.

Property Default Effect
glide.sg.offline.scheduled_download.enabled false Switches scheduled downloads on for all mobile app users
glide.sg.offline.scheduled_download.cachesync_offset 60 minutes How early payload generation starts before the scheduled time
glide.sg.offline.scheduled_download.reminder_offset 15 minutes How early the download reminder appears, when no cache exists or it has expired
glide.sg.offline_payload.refresh_frequency 480 minutes Fixed interval after the scheduled download before the cache refreshes

The offset needs care. If generation starts before the offline scheduling job runs, payloads are not generated. For example, a 10:00 schedule with a 30-minute offset starts generating at 09:30. Turning the feature on does not enroll anyone. Each user still switches on Background downloading in their Offline settings.

Incremental sync and silent pushes

Incremental sync compares the instance with the device and downloads the differences. It tracks additions, updates and deletions in the records defined by data items on each offline screen. It is off by default. Setting glide.sg.offline.incremental.enabled to true turns it on for all users.

Updates arrive as silent pushes, governed by four properties.

Property Default Role
client_polling_interval 1 minute How often the device checks for missed changes, including after it reconnects or wakes
record_watcher_expiration 24 hours How long the record watcher stays active without triggering an update
silent_push.max_pushes_per_hour 3 (maximum 10) Pushes allowed per hour; extra changes move to the next hour
silent_push.min_wait_time 1 minute (range 1 to 1440) Minimum gap between consecutive pushes

The limits interact. With 10 pushes an hour and a 6-minute minimum wait, the tenth push cannot arrive until nine 6-minute gaps have passed, which is 54 minutes after the first. The Background downloading section in the app’s Offline settings includes a Wi-Fi only option. Only the changed records are sent, not a fresh copy of the whole cache.

Manual downloads and payload limits

Download Cache starts a full on-demand download when no cache exists. Update Cache refreshes an existing one. A progress indicator shows while it runs, and the app stays usable. A manual download does not switch offline mode on, so the user selects it in the Offline settings afterwards.

Payload size has no cap, though keeping the offline dataset a subset of online data supports faster downloads and better device performance. Two limits frame the transfer. glide.sg.offline.job.maxRuntime sets how long the server can spend building a payload, up to 20 minutes, with a default of 10 minutes. If generation runs past that, the user sees an error rather than partial data.

Attachments have separate rules. Total attachment storage for offline use is capped at 2,048 MB. The per-cache total comes from glide.sg.offline.attachment.max_total_bytes, which defaults to 50 MB. Allowed types come from glide.sg.offline.attachment.allowed_content_types, which defaults to PNG, GIF, JPEG and QuickTime video.

Offline input forms and reference fields

Offline input forms let a user view, edit and create records from locally cached data. Changes made offline queue for sync. Supported input types are string, number, boolean, date and time, choice, reference, attachment and barcode. Custom map, signature and screen inputs are not supported offline and appear read-only or inactive.

Reference fields need careful planning, because they resolve against the local cache. A reference with no cached data returns no results. For the wider concept, see reference qualifiers. Three rules shape the design:

  • Each reference input caches up to 1,000 records. The cap is per input, not per screen. Two inputs pointing at the same table each contribute a slice, and the device merges them, so one table can exceed 1,000 records on the device.
  • Dynamic qualifiers that depend on live server queries are not supported offline.
  • OfflineFetchScript can return a list of sys IDs to choose the records cached. Without it, the first 1,000 records returned are cached.

Attribute names are case-sensitive. SourceTable, SourceFieldName and TargetTable are required. OfflineConditions, OfflineMobileViewId, SearchType, EnableSearch and OfflineMaxNumRecords are optional.

The Save button stores a form on the device without submitting it, and saved forms can be resumed or submitted later. It behaves the same online and offline.

Syncing offline changes back without duplicate records

Each create, update or delete made offline becomes an outbox item, synced in the order made. If the record changed on the server in the meantime, the item is marked as failed, and the user can retry or resolve the conflict. By default each Save or Submit tap creates its own item. Consolidation can merge consecutive items from the same form or screen into one entry that keeps the latest state.

Records created offline carry a temporary ID. In a scripted write-back action, actionResult.addRecordForSync(tableName, sysId) registers the server record so the platform reconciles it with the local copy on reconnect. The registered data must land in the refreshed or destination document of the response, and a destination screen on the button makes that inclusion explicit. Test this with the testing and acceptance checklist before release.

Attachments added on a form do not show in the record’s activity stream while offline by default. A write-back offline step can reflect them immediately.

Reusable device-side logic lives in mobile scripts, documented for the Brazil release as a subset of web scripts. They are stored in the Mobile script table, pushed to devices inside the offline cache, and called from button conditions and write-back actions. Scripts written before Brazil keep running, and updating them to Brazil syntax is the suggested path.

Frequently asked questions

Do users have to switch on offline mode themselves?

Users download the cache from the Offline mode section of Settings. With scheduled or incremental downloads enabled, each user must also turn on Background downloading, because the system property does not enroll anyone.

Can an offline form hold more than 1,000 reference records?

Each reference input caches up to 1,000 records, and two inputs against the same table add their own slices.

What happens to an offline change if the server record has moved on?

The outbox item is marked as failed during sync. The user can retry it or resolve the conflict.

Does a manual download switch the app into offline mode?

No. The user selects offline mode in the Offline settings after the cache downloads.

Which app supports offline input forms?

Offline mode is set per app. The Mobile Agent app, the Now Mobile app and custom apps can each be configured for it, and the reference-input setup is written for the Mobile Agent app.