Hello,
I'm working on a Dataverse application which includes a form where a user would input values and may click on submit.
We have a request from our client, for the input data to pre-populated if the user navigates away from this form and then uses the browser back button to return. I'm seeing some information about the use of global variables which makes me think that I can store the form values within a global variable and then use this to prepopulate the form when it loads. The other question is how to know that the user returned to the form through the use of the browser back button, rather than using the menu navigation.
I realize this is a very open ended question, but after searching this forum and the web for a considerable time, I decided to post my question. At minimum, I'd love to see some documentation that guides me on the use of global (or session state) variables within Dataverse applications.
Thank you,
Anita
I wouldn't implement this requirement because dynamics OOB doesn't support this, you can try using following way though.
Thanks for these suggestions. I don't believe auto save is an option at this point due to other customizations on the application, but your suggestion of cookies sounds like a good one.
I’m not sure this would preserve state across pages. If this control stayed on the form perhaps but it definitely needs a place to store data.
what I would suggest is perhaps using browser cookies. You might be able to set a cookie on the parent context and add to that context as people enter data into the fields you have. You would have several onchange events that trigger and keep the global context updated. When a user leaves the form without saving and returns, your JavaScript on load event would look to the global context to see if there is an object saved from before, read all the properties and re-add them to the form if the form is a new form. You’d definitely want to be careful not to overwrite existing form data or tie the global context to the record’s GUID.
alternatively why not just enable auto-save and have it keep saving the form so you don’t have to do this workaround? Then the back button works by default to keep their data.
New find, this is potentially a way of preserving state:
I need to determine if state is maintained when using the navigation and also the browser buttons.