Create a single merged document compiled from multiple data sources using sessions. Here's how!
How do sessions work?
Instead of merging data automatically, Formstack Documents saves the desired, encrypted data from your built source. Then when you are ready to merge, it uses all of the data you sent over time for that session and merges it into your template.
An example of this would be you have a construction business that uses a CRM to keep track of all objects like projects, managers, and buildings. Before, if you wanted to generate a contract, you’d have to pick one of your objects, send the data over to Formstack Documents, and then manually enter any missing information.
With Sessions, you can send data from any of your objects and have it go to the same spot. You could send the building information over, then send the project manager’s information over and it will have both sets of information ready for you to merge.
Set up a Session using Formstack Forms
Step 1: Build your Documents Template. Import or create a template from scratch.
Step 2: Include needed fields into Document. Sessions are tracked using a unique key (name, email address, etc) that you choose/define. To ensure that these are tracked, you will need to pass that key in your merge data, using these field names:
- _session
- _session_merge (final merge request only - this tells system to merge the doc!)
- _session_append (append new data into "$_rows" you can loop through in your document)
- _session_expire (number of days until data is expired. Max 30 days)
Step 3: Add merge fields. Under the Settings tab, select Advanced Settings and check "Use Field Map for Custom Integrations." Once saved, the Field Map tab will populate to add merge fields:
Under Custom Fields, include the session types under Value as shown below in the example:
When the session values are added under Custom Fields, the fields will populate under Field Map, as shown here:
Next, fill these in to tie the fields in. ie: _session: {$email}.
Save to capture the field maps.
Step 4: Build out your Formstack Forms. Within Formstack Forms, build out two or more forms. If you do not have a Forms account, review here to get started!
Step 5: Integrate each form with Formstack Documents. Within Formstack Forms, select the Settings tab > Integrations > Formstack Documents and enter your Formstack Documents information to access your documents. See more here for an in-depth look. For each form, fill out the appropriate fields as needed. For Form 1, for example, we would not include information within the _sessions_merge field.
The system will detect the "_session" parameters in the merge data. We look for a session that already exists and will save the new data (if you send data that already exists in the session, we will use the newest data we receive).
If a session with that key does not exist, then we create a new session. Each session is unique to the specific document you are merging (ie: you can use the same key for a different document and it will create a different session).
When you are ready for the data to be merged, you can add the "_session_merge" parameter to the merge data and that will tell our system to merge the session.
The second, and last form, may look something like this in the Formstack Documents integration setup:
Note: Make sure Run Mode is On.
Run a Session
Let's see a session in action using Formstack Forms.
Step 1: Fill out the first form. After, navigate to your Document's Overview tab to view the pending session:
The pending session will reflect when the data was filled out as well as the expiry date (one month after submission).
Step 2: Fill out the second form. Then refresh the Document's Overview tab will refresh a completed merge:
After a session has been merged, the session and data are deleted.
Pass Session data via the Merge URL (via Webhook)
If you are sending data over to Formstack Documents via a Webhook, you can send the session variables in your webhook URL like this:
1st Request: https://www.webmerge.me/merge/12345/abcde?session=John&session_expire=7
Final Request: https://www.webmerge.me/merge/12345/abcde?session=John&session_merge=1
After a session has been merged, the session and data are deleted.
Have any further questions? We’re here to help! Please reach out to support@formstack.com for additional assistance with your use case.
Or check out Professional Services to take on and create projects customized just for you! Schedule a consultation to get started.