Disable "Unsaved Data" Alert When Leaving A Form
How to disable the alert window if the form is dirty because it is containing unsaved data changes.
Based on this forum entry (How to get “unsaved data” exists information aka “page is dirty”) from Daniel Krüger this article describes how to disable the alert window if the form is dirty because it is containing unsaved data changes.

There may be use cases where one doesn’t want to create an instance at all and so there is no need to save data nor to check if there is unsaved data. One use case would be the check if a user owns a valid driver licence (which is stored in other WF instances and information retrieved by a business rule).
JavaScript Form Rule
To deactivate the “unsaved data” alert one can add a simple form rule to the desired process. Example:
- Rule Name: FR - FormIsDirty Check and set not dirty
- Edit mode: JavaScript mode
- JavaScript code snippet:
//Switch for console.log outputconst isDebug = false
function resetIsDirtyInSessionStorage(key = 'WebconBPS_FormIsDirty') { //Get sessionStorage item const raw = sessionStorage.getItem(key); if (!raw) return;
//Parse object const obj = JSON.parse(raw); //Check if is Dirty is true and if yes set it back to false Object.values(obj.mainPlaceholder).forEach(v => { if (v.isDirty) v.isDirty = false; });
//Write modified values to sessionStorage sessionStorage.setItem(key, JSON.stringify(obj));}
//Output values BEFORE manipulation to consoloeif (isDebug) { obj = JSON.parse(sessionStorage.getItem('WebconBPS_FormIsDirty')); console.log(obj);}
resetIsDirtyInSessionStorage();
//Output values AFTER manipulation to consoloeif (isDebug) { obj = JSON.parse(sessionStorage.getItem('WebconBPS_FormIsDirty')); console.log(obj);}Then simply add this form rule to all places (style and behavior in fields, paths, …) where you expect triggers which could lead to the”unsaved data alert.
Don’t miss to create this one as global form rule to prevent code replication.
Comments
Comments will be added here later.