HOW TO GET THE APPID OF A DYNAMIC 365 POWER APP USING JAVASCRIPT

Talha Manzoor
0

 This one’s pretty useful when you’re building out URLs in your JavaScript and you are using the AppId of your model-driven Power App / Dynamics 365. You don’t ever want to hardcode these values, and you will need to move your code across your environments at some point so getting this value programmatically is the best approach.

In the account page below, we see in the URL the AppId of our App – 0da29984-d407-ea11-a81e-000d3a35b116:

 Now, let’s go into debug in the browser and run the code below (of course, you can run this anywhere you need to):

var globalContext = Xrm.Utility.getGlobalContext(); 
globalContext.getCurrentAppProperties().then( function success(app) 
{ console.log(app); },
function errorCallback() 
{ console.log("Error"); });

When we run this, we see in passing a variable into the first parameter (appId), it gives us several pieces of information, including the appId, displayName, uniqueName, url, webResourceId, webResourceName, welcomePageId and welcomePageName:

Read More

Post a Comment

0Comments

Post a Comment (0)