Data & connectors
Build a data source
A connection says which system. A data source says which records. It is the saved query a template runs every time it renders, and it belongs to that template.
There is no query language to learn. You pick, and the builder writes it.
Before you start
- Data sources exist only in the hosted app (signed in to a workspace). Local mode has no connections and no data sources.
- Building one needs the editor role or higher. If the template's Salesforce button uses shared access, only an Admin or Owner can add or change its data sources; everyone else sees View instead of Edit, and New data source is greyed out.
- Your workspace needs a connection, which an Admin adds — see Connect Salesforce or Connect HubSpot.
- The builder reads your CRM with your own login, so you must have authorized the connection yourself. That is the Connect button on the connection's row in Settings → Integrations. Editors see the connections there too and connect their own Salesforce or HubSpot login; only adding and removing a connection is left to Admins and Owners. Without your own authorization the builder shows an error instead of the object list.
Open the builder
Open the data pill — the button at the right of the bar directly above your document that names the data you are previewing. What it offers depends on how far you have got:
- With no connection yet, it shows No connection yet and a Connect button, which opens Settings → Integrations.
- With a connection but no data source, it shows Connected and a Build a data source button.
- If the CRM your connections use isn't available right now, it shows Live data unavailable, with no button. Sample data still works, and live data returns when the CRM does.
- Once the template has a data source, it lists it under Render source, with Manage sources… below.
A data source belongs to a saved template, so Weft saves the template first if it has unsaved changes or has never been saved. The Data sources window then opens for this template. Press New data source.
Pick the object
Under Connection, choose the connection; under Object, the object your document is about — Opportunity, Contact, Order, or one of your Salesforce custom objects. On HubSpot, the list offers Contacts, Companies, Deals, Tickets, Line Items, Products and Quotes, then your HubSpot custom objects by their own names, such as Projects. Tickets, products, quotes and custom objects are listed only when your HubSpot login gave Weft access to them — HubSpot leaves one out when your plan does not include it or it was unticked on HubSpot's consent screen (see Connect HubSpot). Both pickers are searchable; start typing to filter.
The object is the subject of the document. An invoice is about an Order; a quote is about an Opportunity or a Deal. Related records hang off it, which comes later.
Choose the fields
Under Fields, type to search, pick, repeat. Chosen fields collect above the search box as tags; the ✕ on a tag removes it.
Two things beyond plain fields, both on Salesforce only:
Fields on a parent record. You can reach through a lookup — an Opportunity's
Account.Name, a Case's Contact.Email. Pick the lookup field in the picker and it opens the
related object's fields; choose from those. The names above the search box take you back up. No
join to write.
Polymorphic lookups. Where a field can point at more than one kind of record, the picker asks which object you mean before opening it.
HubSpot properties are flat — there is no lookup to drill into. To show a deal's companies or contacts, add them as a related list (below).
Take the fields you need and no more. A narrower query is faster and less likely to be trimmed by permissions you did not expect.
Filter, order, limit
Filters narrow which records come back. + Add filter adds a row: a field, an operator and a value — status equals Closed Won, amount greater than 1000, created after a date.
The operator box shows a symbol, such as ≥. Open it and each choice is spelled out, and pointing at the box shows the one you picked.
| The box shows | The list says | Means |
|---|---|---|
| = | equals | the value is exactly this |
| ≠ | does not equal | anything but this |
| < | less than | below this |
| ≤ | at most | this or below |
| > | greater than | above this |
| ≥ | at least | this or above |
| matches | matches pattern (Salesforce) | a text pattern: a percent sign stands for any text, an underscore for any one character |
| contains | contains word (HubSpot) | a match on whole words: an asterisk stands for any text |
| one of | is one of | any of several values, separated by commas: Won, Open |
A list whose values have commas of their own is shown in brackets — ["Smith, John", "Doe"] —
and saved exactly as shown. You can type a list that way too.
Numbers, dates and true/false values
Type a number as plain digits, with a . for decimals: 1000 or 99.5, without thousands
commas. A true/false field takes true or false.
On Salesforce, type a date as year-month-day: 2026-01-31. On a field that holds a date and a
time, such as Created Date, a date means that whole day in your Salesforce company time zone:
Created Date > 2026-01-31 starts at midnight on 1 February there, and = 2026-01-31 is any time
that day. Salesforce's own date words work too, such as TODAY, THIS_MONTH or
LAST_N_DAYS:30.
A value its field can't take, such as 1,000 on an amount, is refused with a message naming the
field.
Every filter needs a value. A row with a field but no value stops the source saving until you fill it in or remove the row with its ✕.
A filter value can be a parameter rather than a fixed value. Write :accountId and the value
is supplied each time the source runs, so one data source serves every account instead of one
per account. You supply it in the builder's preview, beside the source in the data pill, and a
Weft button on a Salesforce record fills :recordId with that record's ID. Typing a colon offers
the parameters the source already uses.
Order by (optional) sorts the results by one field, ascending or descending — usually a date, descending. Limit (optional) caps how many records come back.
Related records
Most real documents are a parent plus its children: an account with its contacts or an order with its line items in Salesforce, a deal with its contacts or companies in HubSpot. These go under Related lists (optional), shown as an outline: the main object on the top row, and each related list indented under the record it belongs to, with what it reads — its object, how many fields and filters, its limit.
+ Related list on a row adds a list under that row: on the top row, under the main object; on a related list's row, nested under that list. So an order's bundles go on the top row, and the products in each bundle go on the bundles row.
On HubSpot, records are linked both ways — a company has contacts and a contact has companies — so the builder never offers an object that is already above the list you are adding to. Under a deal's companies you can add their contacts, and under those contacts their tickets, but not deals or companies again: that would only read the same records a second time. On HubSpot each row shows the object's name, such as Contacts.
Select a row to edit that list. Its fields, filters and limit open below the outline, headed by its place in the tree — Order › Bundles__r › Products__r — so you always know which list you are changing. Once it has a field you can give it its own filters, as at the top level — only the contacts in one city. On Salesforce a related list takes its own ordering too — most recently created first. On HubSpot it does not: a related list's Order by (optional) is not applied, and its records come back in HubSpot's association order.
A related list with no fields is dropped when you save, and every list under it goes with it — even ones that have fields. Its row says no fields yet until you pick one, and how many lists under it would go too. Remove takes a list out, along with any lists under it.
Related lists can nest up to five levels deep. Each appears under its parent record as a list named after the relationship, such as OpportunityLineItems or contacts, so a table or repeat in your template runs over it.
On limits: a related list's limit is not per parent — it caps the rows fetched for that level across many parents at once. If you are pulling contacts for fifty accounts, set it high enough to cover all of them together.
Name it and set its binding
The name at the top reads Untitled data source until you pick an object, which names it. Give it a name that says what it returns — Closed-won opportunities with line items beats a bare object name. The pencil beside it (tooltip Rename) changes it.
Binding is the name your template reaches this source's data by — records unless you
change it. Under that name sit the first record's fields, for a document about one record, and a
list called records holding every record returned, for a document that repeats. With a binding of
quote, the first record's name is quote.Name and the full list is quote.records.
Preview the rows
Once the source has a name, a connection, an object, at least one field and a binding, and every filter has a value, a Preview box appears. If the source uses parameters, it has a box for each; fill them in. Then press Preview rows.
This runs the real query through the real connection, as you, and shows the first few records it returns, related records included.
Do this before you bind anything. It is much easier to fix an empty result here than to work out later why a rendered document is blank.
Empty result? The usual causes, in order: a filter that is too narrow, a permission your own CRM login does not have, or the wrong object. Preview rows shows an empty result as it is; loading one record into the document says so instead (see Use it).
Save it
Press Create data source, or Save changes when editing. Back — or Esc — returns to the list without saving, and ✕ closes the window. If you have changes that aren't saved, each of these asks first: Keep editing stays, Discard lets them go.
Use it
In the data pill, choose the source under Render source. Fill in any parameters — one box each, named after the parameter — or a Record ID, and press Use live data to design against real records. With a Record ID filled in, the button reads Use this record. Back to sample data returns to the sample.
A source that filters on :recordId has one Record ID box, and it fills :recordId, as a
record button does. A parameter left empty is asked for before anything loads. When you load one
record and no record has that ID, the data pill says No record found with that ID. and the
document keeps what it showed. If the source also filters on something else, such as a stage, the
record may exist but be left out by that filter, so the pill says No record with that ID matches
this data source's filters. instead.
With a source chosen, Preview PDF and Export PDF fill the document from it, reading your CRM as the person rendering. Choose Sample data under Render source to render the sample instead.
Change or remove a source
Manage sources… in the data pill reopens the Data sources window. Edit changes a source; its connection stays fixed once the source is created. Delete removes it after you confirm.
A note on versions
Each time the template is saved, its data sources are saved with that version.
- Publishing freezes the data source along with the content. A published document keeps rendering the query it was published with, even if you go on editing — so changing a data source cannot silently change what an external button produces. See Publish a template.
- Export PDF uses the data source as it stood at the template's last save. Creating or changing a data source does not mark the document Unsaved, so press ⌘S (Ctrl+S on Windows) afterwards: it saves a new version even with nothing else changed. Until then an export runs the earlier query, and fails for a source created since that save.
- Preview PDF, Use live data and Preview rows always use the data source as it is now.
What next
- Put the values into the page → Bind fields
- Check it renders → Preview your document
- Produce the file → Export and archive a PDF