This article details how to optimize the Announcement portlet using the "Customize Announcement Displayed" feature in Liferay Digital Experience Platform (DXP) 7.0. The Announcements app let people 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.
Announcements can be scoped according to the following groups:
- by Site
- by Organizations
- by User Groups
- by Roles
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
- Sign in to Liferay DXP as a system administrator.
- ClickClick Control Panel → Navigation → Add Public Page.
- Add the Announcement portlet to page.
- Click the Manage Entries tab.
- Select Administrator from the Distribution Scope > Roles
- click Add Entry
- Enter the following:
- Title: Administrator Announcement
- URL (optional):
- Content: Administrator Announcement
- Type: The announcement's type. This 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
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.
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, the only available site is Liferay DXP.
- 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, create another site and add several more announcements.
- 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 Distriction Scope in Use
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.
As noted above, other distribution scopes are available: Organizations and User Groups. For Organizations, the Announcement portlet has to be deployed on an Organization's site. It is the same with User Groups. If an announcement is "missing", verify that the appropriate site, organization, user group, or role is in the displaying tab in the Configurations menu.