Gosu text editor

You enter the actual Gosu code used to construct the entity name in the code definition pane underneath the variable table. Studio then replaces the variable with mapped property.

The following Gosu definition code for the Contact entity name shows these mappings.

if (SubType != null && Person.Type.isAssignableFrom(Type.forName("entity." + SubType))) {
  var person = new PersonNameFieldsImpl(){
    :LastName = LastName,
    :FirstName = FirstName,
    :Suffix = Suffix,
    :Prefix = Prefix,
    :MiddleName = MiddleName,
    :Name = Name
  }
  return new NameFormatter().format(person, " ", NameOwnerFieldId.DISPLAY_NAME_FIELDS)
} else {
  var contact = new ContactNameFieldsImpl(){
    :Name = Name
  }
  return new NameFormatter().format(contact, " ")
}

To use the Contact entity name definition, you can embed the following in a PCF page, for example.

<Cell id="Name" value="contact.DisplayName" ... />

Do not use virtual entity methods to define display names. Doing so may result in slow performance. Also, if the entity for which the display name is being generated is retired, calls to virtual methods may behave unpredictably.