A nested data field stores several rows on one contact. Every row has the same subfields, for example the card number, name, card type and expiry date of a season pass. When a mother buys season passes for the whole family, all the passes sit as rows on her contact, the children’s too.
In this guide, you learn how to create a nested data field on a list, how the rows get onto your contacts, and how to use them in segments, emails and flows.
What value does nested data give you?
The whole family’s season passes on one contact card
Often one person buys passes for the whole family. With nested data, each pass is a row on the buyer’s contact. The contact card shows who in the family has a pass and which type it is, and you write to the person who pays.
Remind before each pass expires
A flow can start on a date in the rows, for example the expiry date. Each row starts its own run, so a family with three passes gets a reminder about each pass as it is about to expire. In the email, you merge in the name and card number from that exact row.
Find the families on your list
A segment can find the contacts that have at least one matching row, for example a pass with the card type Child. Send the family offer to those who bring children, and a different offer to those who come alone.
Step 1: Open the list
Go to Lists, click Actions next to the list, and choose Edit list.
You can also create the field when you create a new list. You then fill it in on the Custom fields step in the same way as below.
Step 2: Create the field
Under Custom fields, click Add field and fill in:
- Field name: The name of the field, for example Season passes. It is also the heading on the contact card. At most 30 characters.
- Type: Choose Nested data.
- Merge field: The field’s technical name, used in merge fields, for example
season_passes. It is filled in from the field name and can’t be changed once the field is saved. At most 30 characters.
When you have chosen Nested data, the Subfields section appears below the field.
Step 3: Add the subfields
The subfields are the columns in each row. Click Add subfield for each column, and fill in:
- Subfield name: The column’s name, for example Card number. At most 60 characters.
- Merge field: The subfield’s technical name, for example
card_number. It is filled in from the name. The namesidand_row_idare reserved. - Type: Text, Number, Date, Yes/No, Single-choice option or Multiple-choice option. If you choose one of the option types, write the options under Choices and click Add choice for each new one.
- Key: Turn it on for the subfield that is unique for each row, for example the card number. See The unique key below.

The unique key
Exactly one subfield must be the key, and it must be a text or number subfield. The first subfield becomes the key when you create the field, but you can move it to another one.
Every row on a contact needs a value in the key, and two rows on the same contact can’t have the same value. When you import, Heyloyalty finds the row by its key. A row with a card number that already exists on the contact therefore replaces the old row instead of being added again.
Step 4: Save the list
Click Save changes at the bottom of the page. The field is created on the list, and you can start adding rows to your contacts.
How the rows get onto your contacts
Add rows on the contact
Open the contact and click Edit contact. The field has its own section with a table. Click Add row and fill in the cells. Click the bin next to a row to remove it. The changes are saved when you save the contact.

Import from a file
If you have the passes in another system, you can import them. The file needs one line per row, and the contact’s email or mobile number must be on every line. If Mette has three season passes, she is on three lines.
When you map the columns in the import, choose the nested data field and then the subfield in Subfield. Do this for each column that belongs to the field. The column with the key must be included. Read more about importing in Importing and exporting contacts.
- Lines without a value in the key are skipped.
- If a line has the same key as a row on the contact, the whole row is replaced. Subfields that aren’t in the file become empty on that row.
- A new key becomes a new row. Rows that aren’t in the file are kept.
- The value in an option subfield must match one of the field’s choices. In a multiple-choice subfield, separate the values with a comma or a vertical bar.
Send the rows through the API
If the rows should come automatically from, for example, your ticketing or membership system, your web agency or developer can send them through the Heyloyalty API.
See the rows on the contact card
On the contact card, the field has its own section with the field name as its heading. Each row is a line in the table, with one column per subfield.

Use the rows in segments, emails and flows
Segments
In the segment builder, you find the field under List fields. Choose the subfield, the condition and the value, for example that Card type is Child. The segment includes the contacts that have at least one matching row. Read more in Simple segmentation.
Merge fields in emails and text messages
When you insert a merge field, the nested data field is a group with its subfields. In Row, choose the row’s number, counted from 0, and then click the subfield. The merge field looks like this, for example: {member.season_passes.0.name}, which shows the name from the first row. If the cell is empty, or the contact doesn’t have that many rows, the merge field is empty.
Flows on a date in the rows
A flow with a date-based trigger or a birthdays and holidays trigger can start on a date subfield. In Select date field, it is shown as, for example, Season passes › Valid until.
- Each row whose date matches starts its own run. A contact with three passes that expire on the same day therefore gets three emails.
- In the flow’s emails and text messages, you find the merge fields under row that started the flow. They show that exact row, for example the child’s name and card number.
- If the row is removed before an email is sent, the run stops.
Read more about flows in Create a flow.
Use nested data actively
You have now created a nested data field, chosen subfields and a unique key, and seen how the rows get onto your contacts. With the season passes as rows on the buyer’s contact, you see the whole family on one contact card. You can find the families with a segment and send a reminder about each pass before it expires, with the child’s name in the email. The same setup works for annual passes, memberships and bookings, where one contact has several of the same kind.