Adding Fields to Objects

Liferay 7.4 2023.Q4+/GA102+

Fields are data definitions that represent database columns and store different types of values. By default, all objects include these system fields: Author, Create Date, External Reference Code, ID, Modified Date, and Status. But you can add new fields at any time.

Follow these steps:

  1. Open the Global Menu (Global Menu), go to the Control Panel tab, and click Objects.

  2. Begin editing the desired object definition.

    note

    For 7.4 U47+/GA47+, you can add fields to system objects and access them via Headless APIs. See Extending System Objects for more information.

  3. Go to the Fields tab and click the Add button (Add Button).

    Go to the Fields tab, click the Add button, and enter the required details.

  4. Enter a Label and Field Name.

    Label: This value identifies the field in the Objects UI and can be localized after the field is created.

    Field Name: This value determines the field’s name in the backend and uses camel case. Once a field is published, this value cannot be changed.

    note

    Some field names are reserved by Liferay and cannot be used. See Reserved Field Names for more information.

  5. Select a field Type. Some field types include additional configuration options (e.g., picklist, attachment). See Field Type Reference below for an overview of each type.

    Some options appear during field creation, and others only appear after field creation.

    tip

    You can require some types to accept only unique values. For example, you can prevent users from entering an existing email address. For text or integer field types, enable Accept Unique Values Only.

  6. Determine whether the field is mandatory.

  7. Click Save.

After saving fields to an object draft, you can access additional configuration options. For instance, you can determine whether a field is searchable, limit the number of allowed characters for text fields, and more. Available configuration options depend on the field’s type. If you publish the draft or add fields to an already published object, configuration options are restricted. You can remove custom fields from objects at any time.

important

For Liferay 7.4 U85/GA85 and earlier versions, users cannot remove published fields. After publishing, you can only remove fields added to the object’s side table (i.e., [Initial_Table_Name]_x). See Publishing Object Drafts for more information.

Field Types UI Reference

Field Types (UI)Data Type (HEADLESS)Description
AggregationStringStores read-only values calculated using values from a relationship table. Available functions include count, sum, average, min, and max.
AttachmentRelationship > LongStores files; by default, uploaded files can be no larger than 100 MB. This field supports all file types accepted by Documents and Media.
Auto-IncrementStringStores read-only values calculated by incrementing the last assigned value by 1. You can configure the starting value, prefix, and suffix (e.g., foo200bar, foo201bar, foo202bar, …).
BooleanBooleanStores true or false values. Mandatory boolean fields require a true value from end users.
DateDateStores date values.
Date and TimeDateTimeStores date and time values. You can store time values as entered or convert them to UTC.

Convert to UTC: Stores the time in UTC and displays it in the user’s timezone.

Use Input as Entered: Stores and displays the time as entered, regardless of timezone.
Decimal (previously Double)DoubleStores a decimal number value with a limit of 16 digits.

Example: 999.9999999999999 (16 digits total)
EncryptedStringStores encrypted string values.
FormulaInteger or DoubleStores read-only values calculated using numeric fields in the object definition. During field creation, determine whether the total is stored as an integer or decimal. After creation, edit the field to set its formula. Available functions include add (+), subtract (-), multiply (*), and divide (/).
IntegerIntegerStores an integer up to nine digits in length. You can choose to allow only unique values.

Maximum value: 2147483647

Minimum value: -2147483648
Long Integer (previously Long)LongStores a large integer up to 16 digits in length.

Maximum value: 9007199254740991

Minimum value: -9007199254740991
Long Text (previously Clob)ClobStores a text box value that supports up to 65,000 characters. After creating a long text field, you can limit the number of characters allowed.
Multiselect PicklistStringStores one or more string values from a picklist.
PicklistStringStores one string value from a picklist. After adding the field, go to the Advanced tab to set a default value. You can set this value manually by selecting a specific picklist option or dynamically using the expression builder.
Precision Decimal (previously BigDecimal)BigDecimalStores a high-precision decimal number without rounding, up to 16 decimal digits.

Maximum Value: 99999999999999.9999999999999999

Minimum value: -99999999999999.9999999999999999
RelationshipLongStores the numeric ID for all related object entries. Objects automatically adds relationship fields to objects on the child side of a one-to-many relationship. See Defining Object Relationships for more information.
Rich TextClobStores text with advanced formatting tools and media elements (e.g., images, videos, audio).
Text (previously String)StringStores simple text values up to 280 characters. You can choose to allow only unique values. After creating the field, you can limit the number of characters allowed.

Reserved Field Names

The following field names are reserved by Liferay and cannot be used. If users attempt to create a field using one of these field names, Liferay displays an error message.

FieldDescription
companyIdPortal instance where the entry was created.
createDateWhen the entry was created.
externalReferenceCodeExternal reference code for the entry.
groupIdSite ID where the entry was created.
lastPublishDateDate when the entry was last published.
modifiedDateDate when the entry was last modified.
mvccVersionMVCC version of the entry.
objectDefinitionIdID of the entry’s object.
objectEntryIdID for the entry.
statusWorkflow status for the entry.
statusByUserIdID of the assigned user in Workflow.
statusByUserNameName of the assigned user in Workflow.
statusDateDate when the Workflow status was last updated.
userEmailAddressEntry author’s email address.
userFirstNameEntry author’s first name.
userIdEntry author’s user ID.
userLastNameEntry author’s Last name.
userNameEntry author’s user name.
uuidEntry’s unique universal ID.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy