While playing around cards for Power Apps, I noted that the User Power Fx function that is used in Canvas Apps to detect the current user and get some information about it is not supported.
After some investigation, I found that Cards use a new object called Viewer instead.
How to use the Viewer Object
The viewer object has 3 properties that potentially we could use to filter data by the Current User :
- name: it’s the user Display name
- aadObjectId: ID of the user in Azure AD
- id: weirdly this displays the UPN when loading in the Cards player but it displays something that seems like a Teams identifier when sending the Card in Teams, for example: 29:16a03jETMRncoewiNAeiWgBqzzxv-Rx16996NUHRjgNHW8Bb7449q-Y3ku9-s4a3ZE3AR_e0NQiM-6qx2n3vWIw
Filtering data by the display name can be messy as there could be two people with the same name in the tenant, so going with the aadObjectId would be the most precise way.
Filtering Data
Let’s say you wanted to filter all items…
Source link
More About This Author
-
SharePoint and Office 365 Consultant/Developer always trying to get the best from Microsoft stack (Microsoft 365/Azure/Power Platform and related stuff).
Living in Ireland since 2018, I had previously worked in Brazil as a consultant/developer for Office 365, SharePoint and related technologies for almost 10 years.
Array
- Modern Workplace13 April 2024Power Pages and Cloud Flows ā Validate user against Dataverse records based on Contact ID
- Modern Workplace6 April 2024Download SharePoint library files in Power Pages with JavaScript and Cloud flows ā Improved code using jQuery & option to open PDF file in a new tab
- Modern Workplace13 March 2024Handle multiple N:N records associate and disassociate requests with JavaScript and Power Pages Web API
- Modern Workplace17 February 2024Generic JavaScript Functions to Associate and Disassociate Dataverse records using the Power Pages Web API