The portal broadcast messaging feature is provided with an out-of-the-box sample UI.
Most customers would want to customize the UI to fit their framework page.
You can find more on the BCM here:
New Development: Broadcast Messages in SAP NetWeaver Portal
If you wish to use the BCM out of the box sample UI you will need to add it to your classic/afp framework page,
The application can be found under Portal Content >> com.sap.portal.broadcast.message.framework >> Sample_BroadcastMessageIview
In order to allow this we have opened a client-side API that allows developers to create their own iView and interact with the BCM service.
Prerequisites:
The API
The client side API is under the object window.BCM.API and contains the following methods:
isPollingActive() - this method checks if the BCM polling mechanism is active. If the mechanism is not active, the broadcast messages will be taken from the server only once.
getPollingIntervalTime() - This method returns the number of minutes between each request to the server.
getActiveMessagesForCurrentUser(success callback function, fail callback function) - This method gets all of the user’s broadcast messages (according to the user’s roles and groups) and return them to the success callback function in a JSON format (if successful) or returns a JSON with the status "fail".
Each message in the JSON has the following attributes:
setMessageAsRead(message ID, callback function for status) - Sets the message state to "already read" for this user in the UCD.
The callback function will receive a JSON with a "success" or "fail" status.
Example:
window.BCM.API.getActiveMessagesForCurrentUser(onMessagesReceived, onNotMessagesReceived);
function onMessagesReceived(messagesJSON){
//check that the actual size of the messagesJSON is more than 0.
if(messagesJSON.length > 0)
{
var newMessagesArrived = false;
for(var i = 0; i < messagesJSON.length; i++)
{
createMessage(messagesJSON[i].messageId, messagesJSON[i].messageBody, messagesJSON[i].isRead, messagesJSON[i].isPriority);
// check that this message was not already read and update the new messages flag.
if(!messagesJSON[i].isRead)
{
newMessagesArrived = true;
}
}
}
}
------------------------------------------------------------------------------------------------------
window.BCM.API.setMessageAsRead(messageId,function(data){
// check if the operation has failed or succeeded.
if(data.status !== "success"){
if(window.console){
window.console.log("couldn't set message: "+data.messageId+" as read");
}
}
else{
// if operation succeeded mark message as read in the user interface
changeMessageBackground(messageId);
}
});
If you would like to learn more regarding the BCM API please ask for information in the comments and I will try to add it to the article.
Saar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
36 | |
25 | |
17 | |
13 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 |