Send Salesforce data with each survey
The Send Surveys (nps.today) action can send Salesforce data along with each survey, e.g. the customer's segment, region or account owner. nps.today stores it as custom data on the campaign member, so you can filter on it, export it, and analyse feedback by it in nps.today, Power BI or your own BI tool.
Typical data is business context that only lives in Salesforce, e.g. account ownership, renewal date, segment, region, product or contract value.
You pick the fields in the action. You don't need a formula or any JSON. A campaign member could get:
{
"Title": "Head of Testing",
"Account.Name": "Acme",
"accountOwnership": "Public",
"Account.Owner.Email": "[email protected]",
"source": "Q4 survey"
}
Before you start
- A flow that sends surveys with Send Surveys (nps.today), see Choose how to send surveys. The action is in the latest version of the nps.today package, see Packages & versions.
- You can edit and activate the flow.
A snapshot, not a live link
Custom data is stored when the survey is requested. It holds the values the record had at that moment, and doesn't change when the record changes later.
How it works
Send Surveys (nps.today) has two settings under Custom data. Both end up in the same custom data on the campaign member:
| Setting | What it sends | Example |
|---|---|---|
| Fields | Fields of the record that gets the survey, and of records it looks up to | The contact's Title, the Ownership of its account |
| Fixed fields | The same values for every survey | source = Q4 survey |
Each value gets a key, which becomes a custom data field on the campaign member, and a column in exports and in Power BI.
Step 1: Decide which data to send
Agreed by the nps.today user and the Salesforce admin.
Write down what you need for your analysis, and the key each value gets in nps.today:
| Salesforce field | Key in nps.today |
|---|---|
| Account › Ownership | accountOwnership |
| Account › Renewal date | renewalDate |
| (the same for every survey) | source |
Choose keys that last
Keep keys short, stable and in one style, e.g. camelCase. Renaming a key later creates a second column in exports and Power BI instead of renaming the first one.
Only send data you need for analysis. Custom data is stored on the campaign member in nps.today, so leave out sensitive personal data that has no reporting purpose.
Step 2: Pick the fields
- In Flow Builder, open the Send Surveys (nps.today) action. Choose Send to if you haven't yet.
- Under Custom data → Fields, click Add field.
- Choose the field in the list, e.g. Title. To find it quickly, type a part of its label or its API name.
- For a field on a related record, choose a lookup instead. Lookups are at the end of the list and have an arrow, e.g. Account. The list then shows the fields of that record, so you can choose e.g. Ownership, or Owner to go one record further. The line above the list shows where you are, e.g. Contact › Account, and its arrow takes you one step back.
- Optional: type the key the value gets in nps.today, e.g.
accountOwnership. Leave it empty to use the key shown, e.g.Account.Name. - Click Add field for the next one.

The four rows above add these values:
| Row | Key in nps.today | Value |
|---|---|---|
| Title | Title |
The contact's title |
| Account › Account Name | Account.Name |
The name of the contact's account |
Account › Ownership, with the key accountOwnership |
accountOwnership |
The account's ownership |
| Account › Owner › Email | Account.Owner.Email |
The email of the owner of the contact's account |
Good to know:
- Which fields: the list shows every field of the record that gets the survey (the contact, lead or person account) with its label and API name, also your own custom fields, e.g. Renewal date with
Renewal_date__c. Fields of the record that triggered the flow, e.g. the case, are not in the list, see Data from other records. - Lookups: you can go through up to five lookups. A lookup that can point to more than one object, such as a lead's Owner, isn't listed.
- Values keep their type: dates as
2027-03-31, numbers as numbers, checkboxes astrueorfalse, and picklists as the API name of the value. An empty field is sent asnull. - What-Id: when the action sets a What-Id, it is also stored in the custom data as
whatid. - Paste a list: click Edit as text and write the API names separated by commas, e.g.
Title, Account.Name, accountOwnership=Account.Ownership. Writekey=fieldto choose the key.
Step 3: Add fixed values
For values that are the same for every survey, e.g. which send-out the survey belongs to:
- Under Custom data → Fixed fields, keep Entered here.
- Type a key and a value, e.g.
sourceandQ4 survey. Click Add fixed field for one more.
Fixed values are stored as text. For a number, a list or a nested value, click Edit as JSON and write a JSON object, e.g. {"year": 2026}.
A key can only be used once: not twice in Fields, and not in both Fields and Fixed fields.
Step 4: Save and activate
Click Save As New Version, then Activate.
Warning
The change only takes effect when the new version is active. An older active version keeps running without the custom data.
Step 5: Test it
- Send a survey with the flow to a test contact that has values in the fields you picked, e.g. a test contact with your own email address. In a screen flow, the Message output says if the request was queued.
-
In nps.today, open the campaign and find the new campaign member. The keys and values are shown as custom data on the member.
-
Optional, through the API: call
GET /v2/bi/campaignmembersand check thecustomobject of the campaign member:{ "custom": { "accountOwnership": "Public", "renewalDate": "2027-03-31" } }
Data from other records, e.g. the case
The Fields list only reaches the record that gets the survey and the records it looks up to. To send data from somewhere else, e.g. the case that triggered the flow, build the custom data yourself with a formula, and give it to Fixed fields → JSON from the flow.
Note
JSON from the flow replaces the values typed under Entered here. Put fixed values in the formula instead, e.g. "source": "Q4 survey". Picked Fields are still added.
-
In Flow Builder, click New Resource in the Toolbox, and fill it in:
Resource Type:
Formula
API Name: e.g.CaseCustomData
Data Type:Text -
Enter a formula that builds a JSON object. This example sends the case's origin and type:
'{"caseOrigin": "' + TEXT({!$Record.Origin}) + '", "caseType": "' + TEXT({!$Record.Type}) + '"}' -
Click Check Syntax, then Done.

-
Open the Send Surveys (nps.today) action. Next to Fixed fields, choose JSON from the flow, then your formula. The list says what each resource is, e.g. formula.

-
Save As New Version, then Activate.
How to write the formula
The formula is text glued together with +. The single quotes mark fixed text, and the double quotes inside them are the JSON syntax:
'{"caseOrigin": "' // opens the object and the first key
+ TEXT({!$Record.Origin}) // the first value
+ '", "caseType": "' // closes the value and opens the next key
+ TEXT({!$Record.Type}) // the second value
+ '"}' // closes the last value and the object
To add a field, insert one more '", "yourKey": "' + ... before the closing '"}'.
TEXT() is needed for values that are not text already:
| Field type | In the formula |
|---|---|
| Text, Text Area, Email, Phone | {!$Record.Field__c} |
| Picklist, Date, Date/Time, Number, Currency, Percent | TEXT({!$Record.Field__c}) |
| Checkbox | IF({!$Record.Field__c}, 'true', 'false') |
TEXT()on a picklist returns the API name of the value, not the label.- A double quote in a value breaks the JSON. Remove it:
SUBSTITUTE({!$Record.Subject}, '"', ''). - A line break in a value breaks the JSON. Replace it:
SUBSTITUTE({!$Record.Description}, BR(), ' '). - A blank field gives an empty value. For a placeholder, use
BLANKVALUE(TEXT({!$Record.Type}), 'unknown'). $Recordis the record that triggered the flow. For a record the flow fetched, or the current item in a loop, insert that resource with Insert a resource instead.- The custom data can be at most 8 kb. A flow formula also has a length limit, so build very large JSON in a Text Template or in Apex instead.
Use the data in Power BI
Custom data arrives in Power BI in the Campaignmembers query, in the Campaignmembers.custom column. Expand the column to get one field per key. The steps are in How to add your custom data to your Power BI dashboard.
Tip
When you add a key later, expand Campaignmembers.custom again in Power BI so the new field appears.
Custom data is the same custom object as when a survey is sent through the API with POST /campaigns/{campaignId}/respondent, so your own BI tool reads it the same way.
Troubleshooting
| Problem | What to check |
|---|---|
| No custom data on the campaign member | The fields are picked in the action, and the flow version with the change is the active one. |
| The action rejects the call | A picked field was deleted or renamed after the flow was built, or the JSON from the flow isn't a JSON object. Message gives the reason. See When the action rejects the call. |
| A field isn't in the list | It is on another record than the one that gets the survey. Use a formula. Or the lookup can point to more than one object. |
A value is null or empty |
The field is blank on the record when the survey is requested. |
| A picklist value looks wrong | Picklists are sent as the API name of the value, not the label. |
| Typed fixed values are missing | JSON from the flow is chosen, which replaces them. Put them in the formula. |
| The formula won't save | Click Check Syntax. Usually a + or a quote is missing, or TEXT() is used on a text field. |
| Custom data from the formula looks broken or cut off | A value contains a double quote or a line break, or the JSON is larger than 8 kb. See How to write the formula above. |
| A value from the formula is empty | The field is blank, or the formula uses $Record for a value that is on another record. |
| New keys are missing in Power BI | Expand Campaignmembers.custom again and click Close & Apply. |
Still stuck? Contact [email protected] with the flow name, the campaign ID and the campaign member you tested with.
Using the deprecated Request NPS Ratings action?
It takes custom data as JSON text in its Custom JSON input, built with a formula as above. See Request NPS Ratings (deprecated), and consider moving to Send Surveys (nps.today).