Hi Community,
I'm exploring a lightweight auto-save strategy for a Portal form and would appreciate some guidance.
️ I understand that triggering a Web API on every keystroke or field update is not supported or scalable in Portals — totally agree with that.
Here's the approach I'm considering:
On initial form load, generate a draftId (UUID) and store it (via URL or localStorage).
draftId
localStorage
Hold all inputs in local!formData.
local!formData
Every 30 seconds (or on key actions like tab change or “Save Draft”), send a full snapshot of the form to a Web API using a!toJson(local!formData).
a!toJson(local!formData)
On form reload, use the draftId to fetch and restore the saved draft using a!fromJson().
a!fromJson()
My questions:
Is a!toJson() / a!fromJson() supported and reliable in Portals?
a!toJson()
Can we safely trigger a Web API every 30 seconds to save the form data? Any performance or timeout issues to consider?
Discussion posts and replies are publicly visible
You correctly point out that a!toJson() is REPORTED TO BE "incompatible" with portals - but i believe this claim itself is an error, as after extensive testing on my own sites, it turns out it WORKS JUST FINE. I figure it's a matter of the documentation keeping up with the technology, or something similar.
As to the technical nature of what you're after - I defer to Stefan's guidance, in that integrations *should* be handling JSON conversion for you, and that you should be able to simply pass raw data (unless there's some other special reason you require JSON translation that you haven't specified).