Sunday, August 29, 2021

Preview Send-In App notifications

 Step 1:

    Create a trial Environment Link for Reference

Step 2 :

    Open the trial Environment (You cannot see App Notification Button)






Step 3:

    Go to https://make.powerapps.com

    Click Solutions 

    Create a New Solution

    Create a New Model Driven App by selecting New--> App --> Model-Driven App  --> Copy the UNIQUE Model Driven App name
    

Step 4:

    Open the Created Model Driven Apps --> Click F12 Button --> and Navigate to Console and Run the below code

fetch(window.origin + "/api/data/v9.1/SaveSettingValue()",{ method: "POST", headers: {'Content-Type': 'application/json'}, body: JSON.stringify({AppUniqueName: "Your app unique name", SettingName:"AllowNotificationsEarlyAccess", Value: "true"}) });

Note:

Change "Your app unique name" to your Model Driven App Name

Step 5:

    To make the notification triggering point --> Create a webresource like below and call the function from the ONload of any entity


function OnLoad(executionContext) {

    var formContext = executionContext.getFormContext();

    var systemuserid = formContext.context.getUserId().replace("{","").replace("}","");

    var notificationRecord =

    {

        "title": "Welcome",

        "body": "Welcome to the world of app notifications!",

        "ownerid@odata.bind": "/systemusers(" + systemuserid + ")",

        "icontype": 100000000, // info

        "toasttype": 200000000 // timed

    }

    // Create notification record

    Xrm.WebApi.createRecord("appnotification", notificationRecord).

        then(

            function success(result) {

                console.log("notification created with ID: " + result.id);

            },

            function (error) {

                console.log(error.message);

                // handle error conditions

            }

        );

}


Youtube Link for your reference
Microsoft Link for your reference

No comments:

Post a Comment

How to Import Data from Excel to Multiple tables in PowerApps

Introduction:   I have created a view on how to import data from excel to multiple tables in Canvas PowerApps   Implemented Steps: ...