web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using email address/us...
Power Apps
Unanswered

Using email address/user to hide or show a button

(0) ShareShare
ReportReport
Posted on by

This may have been answered in another post, but I can't find an exact match.

I'm using a canvas powerapp, which will end up as an in-house events creation and booking system.

One of the things I need to do, is show/hide the Edit and Delete buttons from anyone UNLESS they are the Organiser (a field of type People, in a Sharepoint list).

I have created two variables using the OnStart option on the App part of the tree - varUserEmail and varUserName - these are being picked up. Using User().Email and User().FullName respectively.

BUT I cannot get the Default value for the Organiser field in the Edit form to be varUserName (so it, by default, puts the person accessing the app's details into the field of type People) - I get an error 'Expected Record value'.

 

Where am I going wrong? Screenshot attached.

TIA

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    First, you are trying to set the Default property of a Combobox...that property does Nothing!  You need to set the DefaultSelectedItems (DSI) property of the control.

    The DSI property needs a record that matches the Schema of the Items property records.  Your variable is not being set to a record, just text...so you will always see this error.

    What you should be setting that to is completely dependent on the Items property of the combobox.  So, please share that if you continue to have a question on it.

     

    I hope this is helpful for you.

  • Sravani1 Profile Picture
    33 on at

    Hi

    Try to use below code in default selected items property of combobox. 

    Filter(listname, peoplefiled.Username= user(). Email) 

     

    Hope this helps

  • Community Power Platform Member Profile Picture
    on at

    Thanks Randy.

    The Items property for this combobox is set to Choices([@STB_Events].Organiser) from the template.

    I tried a default of User().Email, as that should have the appropriate schema? I read that using the same variable lookup like this over and over wasn't great practice, hence hoping I could just take the varUserName I created earlier and populate it from that.

    So, doing the above, I get an error Expected Table value. It just seems odd I can't just set the default value for a blank entry set easily (even if it's with User().Fullname).

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    No, the Choices function is going to return a table of SharePoint user records.  So, your DSI property must match that.

    And again, to be clear - this is NOT in the Default property of the control as it does nothing, it is in the DSI property.

     

    Change your DSI property to:

    With(User(),
    { 
     Claims:"i:0#.f|membership|" & Lower(Email), 
     Department:"", 
     DisplayName: FullName, 
     Email: Email, 
     JobTitle: "", 
     Picture: ""
    }
    )

    This will match the record properly.

  • Community Power Platform Member Profile Picture
    on at

    That's the badger - thanks!

    I should have clarified I tried my second attempt in the DSI field. Expect more questions though! (I could build this with SQL and PHP in an hour, but having something with built in SSO makes this worth a go)

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    So if it takes an hour with SQL and PHP, then it should only take about 10 minutes with PowerApps!! 😁

    But, PHP and SQL is more development-like - PowerApps is not development - no code!

     

    Glad that worked for you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard