Content - Routes / Pins / Announcement

Announcement

The Announcement API allows you to retrieve available news, display news as announcements or tooltips, and listen for events when users view or read news.

getAvailableNews :method

This method asynchronously returns a list of all news items available for the application.

Method Signature

getAvailableNews(configuration)

Arguments

The configuration object supports the following property:

PropertyTypeDescriptionRequired
filterByTargetAudiencebooleanDetermines whether the currently configured custom labels are used to filter the available news. If this property is not provided, no target audience filtering is applied.No

Code Sample

var configuration = {filterByTargetAudience:true};
window.appnaviApi.news.getAvailableNews(configuration).then(function(resp){
    console.log("Available news are", resp); 
});

showAnnouncement :method

This method displays one or more news items as announcements.

The currently published version of each news item is displayed. If a news item has already been marked as read, it is not displayed again unless force is set to true.

You can display a single news item or multiple news items by providing their IDs in an array.

Method Signature

showAnnouncement(configuration)

Arguments

The configuration object supports the following properties:

PropertyTypeDescriptionRequired
newsIdArrayContains the IDs of the news items to display as announcements.Yes
forcebooleanDetermines whether a news item is displayed even if it has already been marked as read. The default value is false.No

Code Sample

var configuration = {
    newsId:["e7c515f9","f776a70c","c26b05fd"],
    force: true
};

window.appnaviApi.news.showAnnouncement(configuration);

console.log("Announcement has been shown having id " + configuration.newsId);

showInfo :method

This method displays an info-type news item as a tooltip.

The currently published version of the selected info item is displayed.

Method Signature

showInfo(configuration)

Arguments

The configuration object supports the following properties:

PropertyTypeDescriptionRequired
infoIdstringThe ID of the info item to display as a tooltip.Yes
filterByTargetAudiencebooleanDetermines whether the currently configured custom labels are used to filter the info item. If this property is not provided, no target audience filtering is applied.No

Code Sample

var configuration = {
    infoId:"cc9993ac",
    filterByTargetAudience: true
};

window.appnaviApi.news.showInfo(configuration);

console.log("Info has been shown having id " + configuration.infoId);

newsShow :event

This event is triggered when a news item is displayed in the News area.

This event is not triggered when the news item is displayed as an announcement.

Arguments

ParameterTypeDescription
newsIdstringThe ID of the news item that was displayed.

Code Sample

appnavi.event.register("an-newsShow", function(event){ 
    var eventDetails = event.detail;
    var detail = eventDetails.detail;
    console.log("News displayed with ID", detail.newsId); 
});

newsRead :event

This event is triggered when a user marks a news item as read.

It applies to news items displayed both in the News area and in an Announcement window.

Arguments

ParameterTypeDescription
newsIdstringThe ID of the news item that was marked as read.

Code Sample

appnavi.event.register("an-newsRead", function(event){ 
    var eventDetails = event.detail;
    var detail = eventDetails.detail;
    console.log("News read with ID", detail.newsId); 
});

announcementShow :event

This event is triggered when an Announcement window is displayed.

The event contains the IDs of all news items displayed in the Announcement window.

Arguments

ParameterTypeDescription
newsIdsarray of stringsContains the IDs of the news items displayed in the Announcement window.

Code Sample

appnavi.event.register("an-announcementShow", function(event){ 
    var eventDetails = event.detail;
    var detail = eventDetails.detail;
    console.log("The IDs of the news items displayed are", detail.newsIds); 
});

Quick Reference

Method / EventPurpose
getAvailableNewsRetrieves available news items for the application.
showAnnouncementDisplays one or more news items as announcements.
showInfoDisplays an info item as a tooltip.
newsShowTriggered when a news item is displayed in the News area.
newsReadTriggered when a news item is marked as read.
announcementShowTriggered when an Announcement window is displayed.

Did this page help you?