Predefined Element Variables Reference

In the Element Source editor, place the cursor in the desired location and click the variable in the left hand sidebar to insert it. In the Custom JSON Element, you must type the variable directly into the editor. The syntax for each variable appears in the table below.

VariableType: DefinitionSyntax
CONTEXT
Company IDNumber: the company ID of the current instance${context.company_id}
Is Staging GroupBoolean: whether the current site is staged${context.is_staging_group}
LanguageText: the 2-letter code for the current language (e.g., en)${context.language}
Language IDText: the 4-letter language code (e.g., en_US) of the current language${context.language_id}
Layout Name LocalizedText: the localized name of the page${context.layout-name-localized}
Page Layout IDNumber: the ID of the page${context.plid}
Publication IDNumber: the publication ID${context.publication_id}
Scope Group IDthe current site’s ID${context.scope_group_id}
TIME
Current DateDate: the current date${time.current_date}
Current Day of MonthNumber: the day of the month${time.current_day_of_month}
Current Day of WeekNumber: the day of the week (1 = Monday)${time.current_day_of_week}
Current Day of YearNumber: the day of the year${time.current_day_of_year}
Current HourNumber: the current hour${time.current_hour}
Current YearNumber: the current year${time.current_year}
Time of DayTime: the time${time.time_of_day}
Time Zone Name LocalizedText: the time zone, localized for the locale${time.time_zone_name_localized}
USER
Active Segment Entry IDsNumber: the user’s segment IDs${user.active_segment_entry_ids}
AgeNumber: the user’s age in number of years${user.age}
Asset Category Ids (Available 7.4 U41+)Number: the IDs of the user’s categories${user.asset_category_ids}
Asset Tag Names (Available 7.4 U41+)Text: the user’s tags${user.asset_tag_names}
BirthdayDate: the user’s birth date${user.birthday}
Create DateDate: the date when the user account was created in Liferay${user.create_date}
Current Site Role IDsNumber: the user’s site role IDs${user.current_site_role_ids}
Email DomainText: the user’s email domain${user.email_domain}
First NameText: the user’s first name${user.first_name}
Full NameText: the user’s full name${user.full_name}
Group IDsNumber: the IDs of sites the user is a member of${user.group_ids}
User IDNumber: the user’s ID${user.id}
Is FemaleBoolean: true if the user is female${user.is_female}
Is Gender XBoolean: true if the user is gender X${user.is_gender_x}
Is MaleBoolean: true if the user is male${user.is_male}
Is OmniadminBoolean: true if the user is the Omni Admin user (the default user of the default instance)${user.is_omniadmin}
Is Signed InBoolean: true if the user is signed in${user.is_signed_in}
Job TitleText: the user’s job title${user.job_title}
Language IDText: the user’s language code (e.g., en_US)${user.language_id}
Last NameText: the user’s last name${user.last_name}
Parent Asset Category Ids (Available 7.4 U41+)Number: the IDs of all the parent categories of the user’s categories${user.parent_asset_category_ids}
Regular Role IDsNumber: the role IDs for the user’s regular roles${user.regular_role_ids}
User group IDsNumber: the IDs of the user groups that the user is part of${user.user_group_ids}
CONDITIONAL ELEMENTS*
IP Stack CityText: the city where the searching IP address originates${ipstack.city}
IP Stack Continent CodeText: the continent code (e.g., NA for North America) where the searching IP address originates${ipstack.continent_code}
IP Stack Continent NameText: the continent name${ipstack.continent_name}
IP Stack Country CodeText: the country code (e.g., US for United States)${ipstack.country_code}
IP Stack Country NameText: the country name${ipstack.country_name}
IP Stack LatitudeNumber: the latitude in decimal degrees${ipstack.latitude}
IP Stack LongitudeNumber: the longitude in decimal degrees${ipstack.longitude}
IP Stack Region CodeText: the region code (e.g., CA for California)${ipstack.region_code}
IP Stack Region NameText: the region name${ipstack.region_name}
IP Stack Zip CodeNumber: the zip code${ipstack.zip}
Open Weather Map TemperatureNumber: the temperature${openweathermap.temp}
Open Weather Map Weather DescriptionText: a description of the weather (e.g., “clear sky”)${openweathermap.weather_description}
Open Weather Map Weather IDNumber: the ID corresponding to the weather description${openweathermap.weather_id}
Open Weather Map Main LabelText: the primary identifier for the weather (e.g., Rain; this is the Main field in OpenWeatherMap’s API response, according to the weather ID${openweathermap.weather_main}
Open Weather Map Wind SpeedNumber: the wind speed in km/h${openweathermap.wind_speed}
User Custom Fields **the value of a user custom fielduser.custom.field.[name]

* Activate Liferay Commerce to access the Commerce-specific variables.

* Access ipstack and OpenWeatherMap variables by first enabling each service. Visit System or Instance Settings → Platform → Search Experiences. Click the Enabled checkbox and save the configuration for the service you’re configuring. Note that the OpenWeatherMap service depends on the ipstack service being enabled. 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.

Capabilities

Product

Contact Us

Connect

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