
Smart Autosave Field
by Shubham Aware (shubhama926776)
Description
Users filling long or multi-step Appian forms (onboarding, KYC, loan applications, inspections) often lose their work when a session times out, the browser crashes, or they navigate away by accident. Appian's native "Save a draft" is manual and the minimum refresh interval is 30 seconds, so there is no silent, automatic protection against lost input.
Smart Autosave Field solves this. It sits on any interface as an invisible worker, continuously capturing the form's current state and restoring it when the user returns, so they resume instead of re-typing. It works with any field types (text, dropdowns, dates, editable grids, map coordinates) because the developer passes the whole form as a single JSON string via a!toJson() and restores it with a!fromJson(). Common uses: long application forms, multi-step wizards, field/mobile data entry on flaky networks, and shared or kiosk machines with short session timeouts.
Features
Components: smartAutosaveField
- Silent, automatic autosave of form state to the browser (localStorage) with a configurable debounce (default 3 seconds).
- Draft restoration on reload, crash, accidental navigation, or session timeout.
- Flushes the latest unsaved changes on page unload so minimal input is lost.
- Works with any data via a single JSON "data" input (a!toJson in, a!fromJson out): text, dropdown codes, dates, decimals, editable grid rows, map coordinates, nested structures.
- Per-user, per-form isolation via a storage key (sa::username::formId), so drafts never leak between users on shared machines.
- clearDraft input to wipe the draft on successful submit or discard.
- restored and draftTimestamp outputs to drive a custom "Restore / Discard" banner in SAIL.
- Invisible worker: renders no UI and takes no form space.
- Zero external libraries; pure vanilla JavaScript.
Limitations: same browser and device only (not synced across devices), drafts are not encrypted, ~5MB storage cap, and it does not store uploaded file contents (keep document IDs in the saved state instead).