I’ve created a variable to store a default sort order for a datagrid. That works when the datagrid loads.
I have also setup a workflow with “On Sort Changed” trigger to save the user’s desired sort setting to that variable. Unfortunately, when you navigate away from the page, that workflow is triggered and empties the variable. I’m assuming this is an unload behavior where the the datagrid state changes.
Is my only option here to use an explicit ‘Save Default’ button and not use the component trigger?
This is expected behavior: when the page unloads or the datagrid re‑initializes, it can trigger the “On Sort Changed” workflow again and update your variable with that last sort state.
Another solution is to use two variables: one bound to the datagrid (preserved on navigation) and another saved in local storage that represents the “default sort” you really want to persist.
On page load, you read from the local‑storage variable to set the grid’s initial sort, and on intentional sort changes you update that persistent variable if you want to save the new default.