Adding Fields to Objects
Available Liferay 7.4 U76+/GA76+
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:
Open the Global Menu (), go to the Control Panel tab, and click Objects.
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.
Go to the Fields tab and click the Add button ().
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 back-end 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.
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.
Determine whether the field is mandatory.
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. See Configuration Restrictions for Published Objects to learn more.
You can remove fields from object drafts at any time. However, you 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|
|Aggregation||String||Stores read-only values calculated using values from a relationship table. Available functions include
|Attachment||Relationship > Long||Stores files; by default, uploaded files can be no larger than 100 MB. This field supports all file types accepted by Documents and Media.|
|Boolean||Boolean||Stores true or false values. Mandatory boolean fields require a true value from end users.|
|Date||Date||Stores date values.|
|Decimal (previously Double)||Double||Stores a decimal number value with a limit of 16 digits.
|Integer||Integer||Stores an integer up to nine digits in length. You can choose to allow only unique values.
|Long Integer (previously Long)||Long||Stores a large integer up to 16 digits in length.
|Long Text (previously Clob)||Clob||Stores 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 Picklist||String||Stores one or more string values from a picklist.|
|Picklist||String||Stores one string value from a picklist.|
|Precision Decimal (previously BigDecimal)||BigDecimal||Stores a high-precision decimal number without rounding, up to 16 decimal digits.
|Relationship||Long||Stores 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 Text||Clob||Stores text with advanced formatting tools and media elements (e.g., images, videos, audio).|
|Text (previously String)||String||Stores 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.
||Portal instance where the entry was created.|
||When the entry was created.|
||External reference code for the entry.|
||Site ID where the entry was created.|
||Date when the entry was last published.|
||Date when the entry was last modified.|
||MVCC version of the entry.|
||ID of the entry’s object.|
||ID for the entry.|
||Workflow status for the entry.|
||ID of the assigned user in Workflow.|
||Name of the assigned user in Workflow.|
||Date when the Workflow status was last updated.|
||Entry author’s email address.|
||Entry author’s first name.|
||Entry author’s user ID.|
||Entry author’s Last name.|
||Entry author’s user name.|
||Entry’s unique universal ID.|