Introduction
Imagine logging into Dynamics next time and instantly receiving notifications about crucial events during your absence—leads assigned to you, opportunities closed by your team, and newly opened cases. This is now achievable through 'in-app notifications' for Dynamics 365. Simply activate this feature within your model-driven apps, and users will receive notifications upon login, page navigation, or if they remain on a page for over a minute. Notifications can be registered seamlessly from the front-end, back-end, or via the REST API.
Step 1. Access the maker admin portal at https://make.powerapps.com/ and open the model-driven app where you want to activate this functionality.

Step 2. Select the Moder-driven app and click on the edit button.

Step 3. After clicking on the Setting button, Navigate to Features, and toggle the switch to enable 'In-app notifications'.

Step 4. After enabling in-app notifications, proceed to create a JavaScript web resource containing the following code.
function appNotificationAlert(executionContext) {
// Getting the form context from the execution context
var formContext = executionContext.getFormContext();
// Getting the owner (user) of the contact record
var OwnerId = formContext.getAttribute("ownerid").getValue();
// Extracting the GUID of the owner
var userId = OwnerId[0].id.replace(/{|}/g, '');
// Getting the name of the contact
var contactName = formContext.getAttribute("fullname").getValue();
// Getting the GUID of the contact record
var contactId = formContext.data.entity.getId();
var contactGuid = contactId.replace(/{|}/g, '');
// Creating an object representing the application notification
var inAppNotification = {
title: 'On Contact when name will change', // Title of the notification
body: 'On Contact when name will change Case Number: ' + contactName, // Body of the notification
'[email protected]': '/systemusers(' + userId + ')', // Binding to the owner (user) of the contact
icontype: 100000000, // Icon type for the notification
toasttype: 200000000 // Toast type for the notification
};
// Creating the application notification record using the Xrm.WebApi
Xrm.WebApi.createRecord('appnotification', inAppNotification)
.then((result) => {
console.log('Success registered notification with ID: ' + result.id);
})
.catch((ex) => console.error(`Error message: ${ex.message}`));
}




Join the conversation! Your thoughts help the community grow.