When using Creatio, you’ll often see browser notifications when certain actions occur. In this article, we’ll look at how to display your own popup messages from client-side code in Creatio. The end result will look like the following:

Creatio has a module that you can re-use to provide this sort of functionality. This module is called DesktopPopupNotification. To use it, we’ll include two parts. First we’ll have it check if the user has already granted permission for Creatio to display popup notifications and if not, we’ll ask for permission again. Second, we’ll display the notification.
To use the DesktopPopupNotification module, we’ll need to add it to the modules list at the top of the code. In this article, we’ll be adding this to the ContactPageV2, so it would look like this at the top:
define("ContactSectionV2", ["DesktopPopupNotification"], function(DesktopPopupNotification) {
Now, we’ll add an override to the page’s init function to ask for permission to display browser notifications. That will look like this:
init: function() {
this.callParent(arguments);
if (DesktopPopupNotification.getPermissionLevel() !== DesktopPopupNotification.PermissionType.GRANTED) {
DesktopPopupNotification.requestPermission();
}
}
That code checks to see if we’ve been granted permissions and if not, it will request it again. Now we’ll add the code to display the notification. We’ll provide a config with the following:
- id: Some unique value. We’ll get this value if the user clicks the notification (see onClick below) so it could be the record Id value or something
- title: The title of the notification
- body: The actual description text of the notification
- icon: An icon to display in the notification
- onClick: A function to handle if the user clicks the notification
- ignorePageVisibility: (default true), control if the notification shows only if the sending page is visible to the user
- timeout: (default 5000) The number of milliseconds to display the notification before closing
- scope: The scope, used for callbacks like onClick

For our example, I’ll add an image to the images on ContactPageV2 named UsrIcon. With that icon in place, the code to send the notification looks like this:
if (DesktopPopupNotification.getPermissionLevel() !== DesktopPopupNotification.PermissionType.GRANTED) {
return;
}
var config = {
id: 123456,
title: "Test notification",
body: "This is a test notification",
icon: Terrasoft.ImageUrlBuilder.getUrl(this.get("Resources.Images.UsrIcon")),
onClick: this.onDesktopNotificationClick,
ignorePageVisibility: true,
timeout: 5000,
scope: this
};
DesktopPopupNotification.showNotification(config);
When that code runs, we’ll get the notification in the image at the start of this article, assuming the user has given Creatio permission to display browser notifications.




Any update on this methodology for Freedom UI? Whether it still works, and what some of the parameters need changing to (i.e. icon, onClick and scope)
It looks like this functionality broadly still works on Freedom UI pages, the only bit I haven’t yet figured out is how to reference images uploaded to the page schema for the icon. For onClick, an arrow function can be used (e.g. onClick: () => { console.log(“notification clicked”); } ) and therefore the scope isn’t required to be passed.
There did seem to be some weirdness in the behaviour of the Windows notification at least – while it showed and played the sound and could be clicked, it would quickly disappear from the notification centre as soon as the popup notification had finished (but not been clicked) so users would have to click the popup in the short time it was showing if they needed something to happen when clicking it. Maybe there’s a better way to call these notifications in Freedom UI though.
Hi Harvey,
I think the standard for Freedom UI stuff is to use the toast notifications. https://customerfx.com/article/displaying-toast-message-popups-from-creatio-freedom-ui-pages/ However, those can be easily missed if the tab isn’t active. The notifications panels still use the browser notifications but still classic UI (except Chat although that’s not Freedom UI either).
But yes, I would assume all this still works. For the icon< I am still trying to find a way to get images from page resources. Currently, the resources contain only the strings, so not sure how to get that yet. Even the OOTB pages, such as Digital Ads reference URLs to images hosted outside of Creatio rather than using image resources. I assume that it would work to base64 encode an image and then add as a data URL, but haven't tried. Ryan
Also for the scope, I would use the request.$context as the scope. This way, if you need to handle the `onClick` of the notification you have access to the context as `this` if needed to do anything such as navigate to a page etc.
Yes, good thought on using `this`, I’d just been using arrow function notation so could still use request.$context, but nice to remove some of that. I’d also assumed the iamges would be in Resources alongside the localizable strings, frustrating that it’s not the case. And I would use the toast notifications, and have previously, but for this requirement we could really do with the notification having a link to the record triggering it, which I haven’t figured out how to do. An in the message doesn’t seem to work unfortunately.
Oops, accidental link injection! I meant an a href HTML tag in the message doesn’t seem to work.
Ok, I figured out how to get images from resources on a Freedom UI page. Weird that it’s not in the $context.Resources, but you can add the resources in the dependency modules. Basically, same as it was in classic where you could add “SchemaName” + “Resources”. So, for Accounts_FormPage, you’d add:
`define(“Accounts_FormPage”, /**SCHEMA_DEPS*/[“Accounts_FormPageResources”]/**SCHEMA_DEPS*/, function/**SCHEMA_ARGS*/(resources)/**SCHEMA_ARGS*/ {`
Then access the image via:
`resources.localizableImages.TheImageName`
And you can use it the same:
`const img = Terrasoft.ImageUrlBuilder.getUrl(resources.localizableImages.TheImageName)`
Ryan