If you've ever built a mashup for SAP Sales and Service Cloud Version 2 or SAP Enterprise Service Management, you've probably encountered the same challenge: your embedded web application runs inside an iframe, isolated from the host UI. While you can build your own interface, displaying notifications directly within the SAP application was not possible. Until now.
With the new Mashup Initiated Notification feature, external web applications can trigger native SAP notifications using the browser's postMessage API. This allows mashups to display success messages, warnings, errors, and informational messages directly within the SAP Sales & Service Cloud V2 interface.
In this blog post, I'll demonstrate this functionality using a simple mashup application and explain how you can implement it yourself.
See It in Action
To demonstrate the feature, I created a small web application and embedded it as a mashup within an Account in SAP Sales & Service Cloud V2. The application allows users to trigger different notification scenarios and inspect the corresponding JSON payloads sent to the host application.
Let's start with a simple example.
Simple Notifications
The first section of the demo application provides four buttons, one for each supported severity level: SUCCESS, INFO, WARNING, and ERROR. Clicking one of these buttons sends a message to the host application, which then displays the corresponding notification using the native SAP UI.
Screenshot 1: Simple success notification triggered from the mashup
In this example, clicking the Success button triggers the message “Record saved successfully.” at the top of the SAP application. The notification appears outside the embedded mashup and uses the standard SAP styling, including the appropriate severity color and icon. The application also displays the JSON payload in the Last Sent Payload section, allowing us to inspect the message sent to the host.
Notifications with Multiple Detail Messages
In addition to simple notifications, the feature supports more complex scenarios where multiple messages can be grouped into a single notification.
The second section of the demo application demonstrates this using two predefined scenarios: Validation Result (mixed) and Order Failed (with details). For example, clicking Validation Result (mixed) triggers a notification containing several validation results with different severity levels.
Screenshot 2: Expanded notification showing multiple validation results
As shown above, SAP Sales & Service Cloud V2 displays the individual messages with their corresponding severity icons. The notification initially appears in a compact view and can be expanded to reveal all detail messages. This is particularly useful for scenarios where a mashup performs custom validations or interacts with external services that return multiple results.
Just like with simple notifications, the demo application displays the complete JSON payload in the Last Sent Payload section.
How to Implement It
Now that we've seen what the feature looks like, let's take a look at how it works.
The integration uses the browser's built-in window.parent.postMessage API to communicate between the embedded mashup and the SAP Sales & Service Cloud V2 host application. To trigger a notification, the mashup sends a structured message containing the showMessage operation and the notification parameters.
The following JavaScript example demonstrates how to send a notification with multiple detail messages:
window.parent.postMessage({
operation: “showMessage”,
params: {
message: “Validation completed with issues.”,
severity: “WARNING”,
details: [
{
message: “Phone number format is invalid.”,
severity: “ERROR”
},
{
message: “Email address could not be verified.”,
severity: “WARNING”
},
{
message: “Company name was auto-corrected.”,
severity: “INFO”
},
{
message: “Primary contact was set successfully.”,
severity: “SUCCESS”
}
]
}
}, “*”);The message consists of the following elements:
operation: Defines the action to be executed by the host application. For notifications, this must be
showMessage.params.message: Contains the primary notification text.
params.severity: Defines the severity of the primary notification.
params.details: An optional array of additional messages, each with its own severity.
The supported severity values are SUCCESS, INFO, WARNING, and ERROR. These values are case sensitive and must be uppercase. For simple notifications, the details array can be omitted. Only the primary message and severity are required. Once the message is sent, the host application handles the notification rendering. No additional UI components or libraries are required within the mashup.
Conclusion
The Mashup Initiated Notification feature provides a simple way to display native notifications directly within SAP Sales & Service Cloud V2 from embedded web applications. Whether you're displaying a simple success message or multiple validation results, the integration requires only a structured JSON payload and a single postMessage call.
This makes it easier to provide a consistent user experience without having to implement custom notification components inside your mashups.
Source link