To get the Current Environment in canvas app,we can perform the following step:
Step 1: Include Canvas App data source in app and connector PowerAppForMakers as below screenshot.
Step 2: Set the below variable on load or particular event of the screen.
the variable varCurrentEvironmentURL will store the environment url.
Set(currentAppURI, First('Canvas Apps').AppOpenUri);
Set(currentEvmtId, Right((Match(currentAppURI,"/e/.*(?=/a)").FullMatch),36));
ClearCollect(
collAllEnvironments,
AddColumns(
Sort(
PowerAppsforMakers.GetEnvironments().value,
DataSourceInfo.DisplayName
),
"DisplayName",
properties.linkedEnvironmentMetadata.friendlyName,
"Url",
properties.linkedEnvironmentMetadata.instanceUrl
)
);
Set(
currentEnvironmentURL,
First(
Filter(
collAllEnvironments,
currentEvmtId in id
)
).Url
);
No comments:
Post a Comment
Write us your comment.