One lookup, several tables: a customer that's an account or a contact
Sometimes a link can point at more than one kind of record. A course is booked by a company or by a person. In Parsware that's one field, a lookup to several tables, with a tab for each table on the form and a Related tab on both.

A lookup points at a record in one other table. But some links can point at more than one kind of record. An invoice goes to a customer that might be a company or a person. A support case comes from a customer or a partner. A training course is booked by a company or by an individual.
You could add one lookup per table, Booked By Account and Booked By Contact, and remember that only one of them may be filled in. Every form, view, filter and report would then have to know which of the two to read. Parsware has a better answer: one field, Lookup (several tables).
We carry on with the Training Course table, and its Booked By field. Every picture is the real product.
Add the field
On the table's Fields page, choose New, set Data type to Lookup (several tables), and tick the tables it may point at. You need at least two.
The small number beside each ticked table is the order you ticked them in. It's the order people see on the form, and the first one is where the search starts. So tick the most common one first.
For a single table, use a plain Lookup instead. The next section explains why.
What it stores, and what it gives up
The field stores two things in two columns: the record's id, and which table it's in. The second
column has the field's name with _type on the end, and holds the table's logical name, such as
account or contact. A record's owner (a user or a team) is stored the same way.
A plain lookup gets a foreign key, so the database itself refuses to lose the record it points at. A lookup to several tables can't have one, because one column can't reference several tables. So:
- Every save still checks that the record you picked exists.
- If that record is deleted afterwards, nothing stops it. The field then shows the raw reference instead of a name, so the gap is visible, not silent.
- A whole table can't be deleted while a lookup to several tables lists it.
The list of tables is fixed once the field exists, because saved records were checked against it. To change it, delete the field and add it again.
On the form: a tab for each table
Select the field and the search opens with the tables you ticked across its top, in your order. The first one is selected:

Type, and the list narrows within that table:

Choose Contact and the same box searches contacts instead:

The table comes first for a reason. Find an account called Coho and find a contact called Coho are different searches over different columns, so one mixed list would compare things that don't line up. Picking the table first means everything below it works just like a normal lookup: the search, the second line and the pictures. Switching tables clears what you picked, since a contact can't stand in for an account.
Once you've chosen, the field shows the record with its table's icon, because the tabs are out of sight when nobody is picking:
![]()
That's the icon you gave the table. So if tables share a lookup to several tables, give them different icons.
A Related tab on both sides
Each ticked table gets its own relationship, so both ends work the way a plain lookup's do. Open the account, and its Related menu lists Training Courses:

The tab lists the courses Coho Holdings booked:

A contact's record gets the same tab for the courses that person booked. There's nothing to set up on either side.
The field as the table stores it
In the table's document, the field lists its tables in the order you ticked them:
{
"logicalName": "con_bookedby",
"displayName": "Booked By",
"dataType": "PolymorphicLookup",
"targetEntities": ["account", "contact"]
}
Polymorphic is the technical word for "can be one of several kinds". The order of
targetEntities is the order of the tabs on the form, so moving contact first would make the
search start on contacts. Everything else, the two columns, the two relationships and the Related
tab on each table, is worked out from these lines.
What a script and an integration see
On the form the field shows a name and an icon. To a script, a view's export or the record API, it is one value that carries both halves: the table's logical name, a colon, and the record's id.
{
"con_name": "Excel for Finance",
"con_trainer": "6b0d8f2e-6a7c-4a7e-9a55-1f0c2d3b4a11",
"con_bookedby": "account:3f1c9a40-2b7d-4c6e-8f10-5a9b8c7d6e21"
}
Compare the two lookups. Trainer can only ever be a contact, so its value is just the id. Booked
By could be either, so its value says which. An integration that books a course for a person
sends "con_bookedby": "contact:<id>"; one booking for a company sends "account:<id>". The save
checks that the table is one of the field's tables and that the record exists, and refuses the
value with a message if not.
Keeping it as one value is what makes the rest of the platform need no special case. A record is
still a flat list of field names and values, so imports, exports, views and scripts handle it like
any other field. The platform writes other references the same way: a file on a record is
recordfile:<id>.
The ids above are made up for the example.
Filtering and reporting on it
Because the field is one column with a table beside it, a view can show it as one column, Booked By, holding company and personal bookings side by side, each with its table's icon. A filter can ask for one particular account or contact, or for courses where nobody has booked yet.
That one column is the point. Compare it with the two-field design from the start of this article:
| Question | Two lookups (Booked By Account, Booked By Contact) | One lookup to two tables |
|---|---|---|
| Who booked this course? | Look at both fields, use whichever is filled | Read one field |
| Courses nobody has booked | Both fields empty | The field is empty |
| A view of every booking | Two columns, half of each empty | One column |
| Both filled in by mistake | Possible, and nothing stops it | Impossible |
| Add a third table later | A new field, and every view, filter and report changed | Add a new field, with three tables, as below |
The owner is one of these
Every record in Parsware has an owner, a user or a team, and the owner is stored exactly this
way: an id, and which of the two tables it belongs to. That is why a record's owner shows with a
person's picture or a team's icon, and why its value in a script reads systemuser:<id> or
team:<id>.
The owner differs in one way. On a form it looks and works like any other lookup to several tables: put the Owner field in a section, pick User or Team, choose, and save. Behind the form, though, the change goes through assignment rather than an ordinary save, because the owner decides who may see the record at all and has to be decided in one place. Change who owns a record shows how, and Teams explains what owning a record as a team means.
Good uses, and one to avoid
Reach for a lookup to several tables when the value really is one thing that may be of different kinds:
- A customer on an invoice, a case or an order: an account or a contact.
- What a note is about: a project, a task or a meeting. This is how a customer timeline can gather activity from several tables.
- Who requested something: an employee, or a contractor kept in a separate table.
Avoid it when one table would do, just in case another comes along later. A plain lookup has a foreign key, so the database itself refuses to lose the record it points at. A lookup to several tables trades that protection for flexibility, and the trade is only worth making when you need the flexibility now.
Planning the list of tables
Because the tables are fixed once the field is saved, it pays to think about the list before you tick.
- Tick only tables a value can really be. Every extra table is another tab on the form and one more place for a wrong choice.
- Put the most common first, so the search opens on it. If most courses are booked by companies, Account goes first.
- Give each table its own icon. Once a record is chosen, the icon is the only sign of which table it came from.
- Check each table's second line. The line under each search result comes from the table's secondary text, so a contact can show an email and an account a city. Lookup views and quick find explains how.
If you do need a third table later, add a new field with all three, copy the values across, put the new field on the forms and views, and delete the old one. The values move as they are, since each one already names its table.
Questions that come up
Can one record be booked by a company and a person at once? No, and that is deliberate: the field holds one value. If a course is booked by a company for a named person, that is two facts, so use two fields: Booked By for the company and a plain lookup to Contact for the attendee.
What does the field show if the record it points at is deleted? The raw reference, such as
account:3f1c…, instead of a name. That looks odd on purpose: a missing link that showed as an empty
field would be mistaken for a course nobody booked. Choose a new value, or clear the field, and the
form is tidy again.
Does the search on the Contact tab use the contact's own lookup and quick find views? Yes. Each tab behaves exactly like a plain lookup to that table, with the table's own columns, second line and pictures.
Can a lookup to several tables include a table from another solution? Yes, as long as the environment it is imported into has that table too. The import checks every table in the list before it creates the field.
When to use which
| You need | Use |
|---|---|
| A link to one table | Lookup. You get a foreign key. |
| A link to one of several tables | Lookup (several tables). One field, and one place to read it. |
| Several links at once, such as many attendees | A separate table with a lookup, one row for each link |
Next: relationships between tables, and what happens to the linked records when one is deleted.