This article will take you through how you can use SOQL Queries with Formstack Documents, but did you know...Formstack offers a Partner Consulting program where you can team up with third party Certified Formstack experts to bring your custom projects to life. For those who want to customize their documents but do not have the time or internal resources to get these projects completed. For more information on pricing and to book your consultation, please click here!
However, If you're comfortable with SOQL queries and you want to pull in a custom list of object/records from Salesforce, we have a way for you to write your own queries.
Note - Creation and maintenance of SOQL queries are outside the scope of Formstack Support and any assistance provided will be limited.
The result of the queries will be a list of records, so you need to setup a loop in your document. Then in your Formstack Documents Mapping, you'll find that loop merge field, and you'll select << SOQL Query >> from the dropdown.
Then you'll see a text box where you can enter your query:
Use field values in query
This query can include fields from the main object you're pulling data from in the Mapping (ie the Account record). Our system will search for this format in the query:
:FieldName
So for example, if you wanted to include the Account's Name in the query you would use:
:Name
Default System Fields
:UserInfo.Id
:UserInfo.Name
:UserInfo.Email
:UserInfo.FirstName
:UserInfo.LastName
:UserInfo.ProfileId
:UserInfo.RoleId
:UserInfo.Type
Using the query result
The result of this query (ie the data that's sent over to Formstack Documents) will be in a list/array that you can loop through in your document. Inside the loop, you'll use the subfields that you queried to print the values.
Here's an example:
{foreach from=$opps item=_row}
{$_row.Name}
{/foreach}