To whomever may find this post and is still looking for an answer:
In Strapi v4 the configuration for the entry title of a content type isnt stored in the code, it is stored in the database in a table called strapi_core_store_settings.
This table contains key-value pairs where the key references a given content type and the value is a JSON containing its settings.
When you update “entry title” of content type A – let’s say you set it to “title” – in the admin panel, you’re updating the “mainField” field in the JSON (value column) of content type A in the database, and from that moment on, any new relations created in strapi that reference content type A will use the field “title” as a view.
Nevertheless, this doesn’t update the mainField of existing relations. For that, you have to update the mainField of each relation referencing content type A.
So in the question above, the solution would follow these steps:
- Update entry title of YYY to text_field (you can do it in the admin panel or in the database)
- Update the JSON of the value column of XXX and change the mainField value of the relation to YYY from ID to text field.
if it’s small scale you can do it manually, otherwise a python script should do the trick.