Hi,
Can you try below code-
=================
var AB = AB || {};
AB.Ribbon = (function () {
//defaulting button visibility and promise completion to false
var isButtonEnabled = false;
var isPromiseCompleted = false;
function IsButtonEnabled(formContext, appUniqueName) {
var appName;
var globalContext = Xrm.Utility.getGlobalContext();
globalContext.context.getCurrentAppProperties().then(
function (appProperties) {
appName = appProperties.uniqueName;
},
function (error) {
appName = "";
}
);
alert(appName);
}
return {
IsButtonEnabled: IsButtonEnabled
};
})();
=======================