How to get application name using JS in D365

 When we run this, we see in passing a variable into the first parameter(appName), 

it gives us several pieces of information, including the appId, displayName,

uniqueName, url, webResourceId, webResourceName, welcomePageId and welcomePageName


function appName() {

var globalContext = Xrm.Utility.getGlobalContext();

globalContext.getCurrentAppProperties().then(

    function success(app) { console.log(app); }, 

function errorCallback() { console.log("Error");

 });

}


async function CheckAppNameForSpecificValue() {

    returnBoolVal = false;

    var globalContext = Xrm.Utility.getGlobalContext();

    await globalContext.getCurrentAppName().then(function (appName) {

        if (appName.displayname.toLowerCase() == 'myappname') {

            returnBoolVal = true

        }

    },

        function (error) {

            console.log('err ' + error.message)

        });

    return returnBoolVal;

}


Comments

Popular posts from this blog

Basic Plugin Code in D365 using C#

CURD (Create, Update, Retrieve and Delete) Operation in D365 using Power Shell Script

Meta Data Using WebApiRequest