Show more than 1 field of relational data field,

System Information
  • Strapi Version: 3.6.5
  • Operating System: MacOS Catalina
  • Database: SQLite 3
  • Node Version: 14.17.1
  • NPM Version: 7.20.0
  • Yarn Version: —

Hi, strapi-newbie here!

I am trying to find out, if it is possible to show more than only one field in the select boxes ( and below), where relational data is selected from. Same thing for entry title.

I have a table “person”, and it just so happens that there will be more people, whose last name is “Muster”. In order to distinguish them, I should show at least these fields:

last_name, first_name, date-of-birth[, nationality]

How can I do that, if it is possible at all?

Well, this is not currently possible. You may check this post.

But I can recommend a workaround with lifecycle hooks that may help you.

Create a field called display_title or something like this. In beforeUpdate and beforeCreate lifecycle hooks add a new logic that will concatenate your fields last_name, first_name, date_of_birth, nationality in the display_title:

Raw example:

beforeUpdate(params, data) {
   data.display_title = `${data.firstname}, ${data.lastname}, ${data.date_of_birth}, ${data.nationality}`;

Recommendation: You also should add some logic to verify if these values exist. Or verify if these values changed before update them.

After you created all that logic, you can choose the display_title to be displayed in relations.