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

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...