With the renaming of Common Data Service to Dataverse and the launch of Dataverse for MS Teams, you might wonder how to create a Power Apps link to specific screens or items in your app. Using parameters for Power Apps has been possible for a while, but it gets a bit more complicated with MS Teams. In this blog post, we’ll explore how to use deep links to Power Apps within MS Teams.
What is Deep Linking?
Deep linking refers to using a hyperlink to link to a specific piece of web content on a website, such as a particular screen, an item in a gallery/form, or prefilled values in Power Apps.
Linking to Specific Screens in Power Apps
You can achieve deep linking in Power Apps by using parameters, which are predefined or custom app-link extensions. Outside of MS Teams, you would:
- Get the Link to Your App:
- Go to https://make.powerapps.com.
- Click on the three dots next to your app and select Details.
- Copy the Web link.
- Add Parameters to Link to Specific Screens:
- Modify the link to include parameters for specific screens or items.
For example:
- Link to a specific screen:
https://apps.powerapps.com/play/appId?tenantId=tenantId&screen=Screen2
- Link to a specific item:
https://apps.powerapps.com/play/appId?tenantId=tenantId&screen=Screen2&itemID=3
- Add Logic in Power Apps:
- Use an If statement in App.OnStart to check for the “screen” parameter and navigate accordingly:
PowerApps If(Param("screen") = "Screen2", Navigate(Screen2))
- Use the “itemID” parameter to filter data in a form:
PowerApps LookUp(Employees, ID = Param("itemID"))
Deep Linking in MS Teams
Unfortunately, you can’t directly use custom parameters in MS Teams. However, you can reuse existing ones, like subEntityId
.
- Open the App in MS Teams:
- Click on the three dots in the top right corner.
- Select “Copy link to tab.”
- Modify the link to include your parameters.
For example:
https://teams.microsoft.com/l/entity/appId/_djb2_msteams_prefix_3552593819?context={"subEntityId":3,"channelId":"channelId"}&groupId=groupId&tenantId=tenantId
- Use Parameters in Your App:
- Access the
subEntityId
parameter within your app and build logic around it.
Bonus Tip: Create a Teams Context Collection
To get all possible parameters, add them to a collection:
ClearCollect(
colParameters,
{
source: Coalesce(Param("source"), "web"),
groupId: Coalesce(Param("groupId"), "00000000-0000-0000-0000-000000000000"),
teamId: Coalesce(Param("teamId"), "19:[team-id]@thread.skype"),
channelId: Coalesce(Param("channelId"), "19:[channel-id]@thread.skype"),
teamName: Coalesce(Param("teamName"), "Team unknown"),
channelName: Coalesce(Param("channelName"), "Channel unknown"),
chatId: Coalesce(Param("chatId"), "19:[chat-id]@thread.skype"),
theme: Coalesce(Param("theme"), "default"),
channelType: Coalesce(Param("channelType"), ""),
teamSiteUrl: Coalesce(Param("teamSiteUrl"), ""),
locale: Coalesce(Param("locale"), ""),
entityId: Coalesce(Param("entityId"), ""),
subEntityId: Coalesce(Param("subEntityId"), ""),
tid: Coalesce(Param("tid"), ""),
isFullScreen: Coalesce(Param("isFullScreen"), ""),
userLicenseType: Coalesce(Param("userLicenseType"), ""),
tenantSKU: Coalesce(Param("tenantSKU"), "")
}
);
Access these parameters like this:
First(colParameters).theme
Conclusion
While Microsoft doesn’t yet support custom parameters for deep linking in MS Teams, you can reuse existing parameters as a workaround. Hopefully, Microsoft will provide more robust support for custom parameters in the future. If you have comments, tips, or questions, feel free to drop a comment.