I believe this is in regards to the Title Format
feature, so just to be explicit in what I'm referring to, Craft Documentation calls this a Dynamic Entry Title.
The syntax you are looking for can take two forms:
1) Long form object syntax
Just as on the front end your entry
is available via the {{ entry }}
variable, within your Title pattern on the back end, the current entry is available via the {{ object }}
variable.
So I believe the following should work, assuming you are using the actual field names:
{{ object.eventBooking.one().title }} - {{ object.userBooking.one().username }}
You need to use the one()
method here because Relations fields return an array by default. Since you need to output your content directly, you need to make sure you are accessing the title
and username
properties via the Model they are associated with in that array. If your fields are required, you can safely assume that the first item will exist in the array.
2) Short hand syntax
If what you are doing is simple, Craft gives you the option to make the syntax a bit easier and omit the object
variable. So the above could also be written with single curly braces as such:
{eventBooking.one().title} - {userBooking.one().username}