Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Issue using Microsoft.CIFramework.notifyEvent api to generate notifications

(1) ShareShare
ReportReport
Posted on by 2
We are facing the following issue when using Microsoft.CIFramework.notifyEvent api to generate notifications with template configured as msdyn_desktopnotificationmode = 509180001 (When app is in background), it should only show the notification when the app is in background, but currently is always showing the notification.
 
Ex: templateExample configured as msdyn_desktopnotificationmode = 509180001;
 
var input = {
templateName: "templateExample",
templateParameters: {},
correlationId: "voice",
cancellationToken: "cancellationtoken123"
};
 
Microsoft.CIFramework.notifyEvent(input).then(
function success(result) {
console.log(result);
},
function (error) {
console.log(error.message);
}
);
  • Suggested answer
    Muhammad Shahzad Shafique Profile Picture
    272 Most Valuable Professional on at
    Issue using Microsoft.CIFramework.notifyEvent api to generate notifications
    notifyEvent does not currently respect the msdyn_desktopnotificationmode setting in notification templates. It always shows the notification, regardless of whether the app is in the foreground or background.

    You need to programmatically check app visibility using Microsoft.CIFramework.getClientState() before calling notifyEvent. Only trigger the notification when the app is in the background.

    Microsoft.CIFramework.getClientState().then(function (state) {
        if (state.appState === "Background") {
            var input = {
                templateName: "templateExample",
                templateParameters: {},
                correlationId: "voice",
                cancellationToken: "cancellationtoken123"
            };
            Microsoft.CIFramework.notifyEvent(input);
        }
    });

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 149 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 61 Most Valuable Professional

#3
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 53 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans