Predefined Element Variables Reference¶
To add a Predefined Variable to the Element in the Element Source editor, place the cursor where the variable will be, then click on the variable in the left hand sidebar to have it inserted. In the Custom JSON Element you must type the variable directly into the editor. The syntax for each variable is included in the table below.
Variable |
Type: Definition |
Syntax |
---|---|---|
Company ID |
Number: Return the company ID of the current instance |
|
Is Staging Group |
Boolean: Return whether the current site is staged |
|
Language |
Text: Return the 2-letter code for the current language (e.g., |
|
Language ID |
Text: Return the 4-letter language code (e.g., |
|
Layout Name Localized |
Text: Return the localized name of the page |
|
Page Layout ID |
Number: Return the ID of the page |
|
Publication ID |
Number: Return the Publication ID |
|
Scope Group ID |
Return the current Site’s ID |
|
Current Date |
Date: Return the current date |
|
Current Day of Month |
Number: Return the day of the month |
|
Current Day of Week |
Number: Return the day of the week (1 = Monday) |
|
Current Day of Year |
Number: Return the day of the year |
|
Current Hour |
Number: Return the current hour |
|
Current Year |
Number: Return the current year |
|
Time of Day |
Time: Return the time |
|
Time Zone Name Localized |
Text: Return the time zone, localized for the locale |
|
Active Segment Entry IDs |
Number: Return the User’s segment IDs |
|
Age |
Number: Return the User’s age in number of years |
|
Birthday |
Date: Return he User’s birth date |
|
Create Date |
Date: Return the date when the User Account was created in Liferay |
|
Current Site Role IDs |
Number: Return the IDs of the User’s Site Roles |
|
Email Domain |
Text: Return the domain of the User’s email |
|
First Name |
Text: Return the User’s first name |
|
Full Name |
Text: Return the User’s full name |
|
Group IDs |
Number: Return the IDs of Sites the User is a member of |
|
User ID |
Number: Return the User’s ID |
|
Is Female |
Boolean: Return true if the User is female |
|
Is Gender X |
Boolean: Return true if the user is gender X |
|
Is Male |
Boolean: Return true if the user is Male |
|
Is Omniadmin |
Boolean: Return true if the user is the Omni Admin User (the default User of the default Instance) |
|
Is Signed In |
Boolean: Return true if the User is signed in |
|
Job Title |
Text: Return the User’s job title |
|
Language ID |
Text: Return the User’s language code (e.g., |
|
Last Name |
Text: Return the User’s last name |
|
Regular Role IDs |
Number: Return the Role IDs for the User’s Regular Roles |
|
User group IDs |
Number: Return the IDs of the User Groups that the User is part of |
|
IP Stack City |
Text: Return the city where the searching IP address originates |
|
IP Stack Continent Code |
Text: Return the continent code (e.g., NA for North America) where the searching IP address originates |
|
IP Stack Continent Name |
Text: Return the continent name |
|
IP Stack Country Code |
Text: Return the country code (e.g., US for United States) |
|
IP Stack Country Name |
Text: Return the country name |
|
IP Stack Latitude |
Number: Return the latitude in decimal degrees |
|
IP Stack Longitude |
Number: Return the longitude in decimal degrees |
|
IP Stack Region Code |
Text: Return the region code (e.g., CA for California) |
|
IP Stack Region Name |
Text: Return the region name |
|
IP Stack Zip Code |
Number: Return the zip code |
|
Open Weather Map Temperature |
Number: Return the temperature |
|
Open Weather Map Weather Description |
Text: Return a description of the weather (e.g., “clear sky”) |
|
Open Weather Map Weather ID |
Number: Return the ID corresponding to the weather description |
|
Open Weather Map Main Label |
Text: Return the primary identifier for the weather (e.g., Rain; this is the Main field in OpenWeatherMap’s API response, according to the weather ID |
|
Open Weather Map Wind Speed |
Number: Return the Wind Speed in km/h |
|
User Custom Fields ** |
Return the value of a User Custom Field |
|
* Activate Liferay Commerce to access the Commerce-specific variables.
* Access Ipstack and OpenWeatherMap variables by enabling these services. Visit System or Instance Settings → Platform → Search Experiences. Click the Enabled checkbox and Save the configuration for the service you’re configuring. See Personalizing the Search Experience for an example using the Ipstack service.
** In addition to these out-of-the-box variables, Custom Fields on the User entity can also be referenced as variables in the Element. For example, a User Custom Field with the name Employee is referenced in an Element with user.custom.field.employee
.