This article details how to optimize the Announcement portlet using the Customize Announcement Displayed feature in Liferay Digital Experience Platform (DXP) 7.1. The Announcements app allows users to broadcast important information to different groups of users. Each announcement can be created in a specific scope so that users can manage which announcements are sent to which users. Once content creators select a distribution scope, they will see a list of that scope's existing announcements.
Resolution
Announcements can be scoped according to the following groups:
- by Roles
- by User Groups
- by Sites
Although announcements can have multiple scopes, all announcements must have at least one scope or else they will not be displayed. The only exception is that all General Announcements will be displayed on all sites regardless of scope; hence the name "General."
To demonstrate how announcements can be limited by roles and sites, all that is needed are two users; one as the systems administrator and guest or power user role.
Create an Announcement on the Liferay DXP site
- Sign in to Liferay DXP as a system administrator.
- Click Build → Pages.
- Click the plus button → Public Page.
- Click Widget Page.
- Give the page a name: Announcements
- Click Save.
- Choose a layout (e.g. 2 Columns 30-70) then click Save.
- Click the 3 dot icon → View.
- Add the Announcements portlet to page.
The new Announcements portlet has been updated and simplified. Here, users create announcements quickly first and can manage them later.
- Click the Add Announcement button.
- Enter the following:
- Title: Administrator Announcement
- URL (optional):
- Content: Administrator Announcement
- Select Administrator from the Distribution Scope → Roles.
- Type: The announcement type can be General, News, or Test. As mentioned earlier, each user can specify a different delivery mechanism for each type of announcement.
- Priority: Normal
- Display Date: (same date)
- Expiration Date: (default date)
- Click Save
One big difference from DXP 7.0, is that in 7.1, announcements are not displayed until the correct scope has been chosen. That means, even though the user is signed in as the administrator and is on the Liferay DXP site, until Administrator has been chosen in the configuration menu, this newly created announcement is not displayed.
Sort Announcements by Role
Once the announcement has been created, if users select another Role besides Administrator, this announcement will not display. This can be verified by changing the Distribution Scope or signing out and then viewing the announcements as guest, as long as Guest View has been enabled in the Permissions settings.
Figure 1. The Announcements portlet can be scoped by roles.
Figure 2. The Announcements portlet is restricted; no Roles have been selected and Guest and Site Member Views have been disabled.
Sort Announcements by Sites
Content creators and administrators can also add announcements from other sites.
- Click the three dots icon on the Announcement portlet then select Configuration.
Figure 2. This image shows which site's announcements will be displayed. Here, two other sites are available. - As long as the Customize Announcements Displayed box is checked, users will have the ability to choose which announcements to display, even if they were created on a different site. To display other site's announcements on the same page, select a site then use the left arrow to add it to the current field.
- Follow the steps above to add an Announcement portlet to the new site. Once the Announcement portlet has been added to the page, users will see the Administrator Announcement created on the main Liferay DXP site in the New tab IF the Customize Announcements Displayed is unflagged.
Figure 3. The Announcements portlet is now configured to display all announcements from all sites.
No Distribution Scope Active
This is for portal administrators who do not see the need to set a scope for announcements. Note that this setting overrides the Distribution Scope under the Manage Entries tab.
Figure 4. All announcements including Test types are displayed if inactive.
Additional Information
As noted above, the last distribution scope available is User Groups. Organization distribution scope—formerly available in DXP 7.0—has been removed in DXP 7.1.