I am wondering if there is a way to prefill a form by providing the tracking code of a previous form. We want it so a user submits a form and then, later, if their circumstances change they can load another form with all the details prefilled with their original submission data.
Is there anyway to achieve this?
While this is possible, using a Groovy Form Prefill Service, I would advise against it. As you're probably aware, Transaction Manager is not designed to be the final storage location for data. The system is designed with data collection in mind, the goal being that the data ends being processed and/or stored in other systems with straight-through-processing or via manual processes.
Transaction Manager is typically configured to purge transaction data after a period of time following delivery. Once the data is purged, although a record of the transaction remains in the system for analytics purposes, the data you might use to prefill a new form would be gone (submission XML).
The ideal solution would be to pre-fill the new forms with data from your System(s) of Record, which are ultimately responsible for storing the data collected by Transaction Manager. This could be done in a variety of ways, the most common being a Web Service call.
That said, this was all written without fully understanding your requirements, so if after reading this you decide you would still like to prefill from previous submissions, I would be happy to provide a script to get you started.
We will probably do this using the way Lin mentioned, since as you said TM isn't a storage facility.
The agency doesn't even have a database. But they will be storing the PDFs.
We're considering sending them the XML too for storing and allowing them to create tasks to prefill a form from that XML that they can then send to the customer to edit and submit. I just tried this in test and that seems to work.
One of the options that has been considered is to embed the XML file into their PDF receipt. Then on the data entry form, we can have an option to upload a previous PDF receipt. Manager would then extract the XML from the previous receipt, and use this to populate the form. The advantage of this approach is that they wouldn't have to worry about storing both a receipt and a (very un-user-friendly) XML file.
Do you think this would be a useful approach?