cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aladin
Level: Powered On

Condition on User=Author to Hide the Delete Button (Detail Screen)

Hi All,

 

I'm stuck on my Details Screen with my Delete/Remove Item Button.

I've generated my App from a SharePoint List.

From the BrowseScreen the user selects an item in the Gallery and the details of this item are displayed in the DetailsScreen.

 

On the DetailsScreen I would like to add a condition OnVisible to hide my Delete/Remove Item Button if the current user is not the one having created the concerned item.

Meaning: if the current user selects an item that he/she hasn't created, he/she cannot delete it because the Delete/Remove Item button will not be visible on the DetailsScreen.

 

I'm trying a lot of different ways, from  If(BrowseGallery1.Selected.Author.Email = User().Email,true,false) to BrowseGallery1.Selected.Author.DisplayName = User().FullName and also trying to find a workaround using Mid(User().FullName,Find(" ",User().FullName) + 1) etc.

Nothing is working: there is no error in my formula but the only results are not conclusive (everything is always either 'true' or 'false', there is no change whatever the selected item is...).

 

Would you already have encoutered this issue and have a solution?

 

Thanks,

Aladin

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
o365masters
Level: Powered On

Re: Condition on User=Author to Hide the Delete Button (Detail Screen)

Trying adding labels to your page to show you what each of the values you are trying to compare are in fact the same. I have experienced situations in the past when the native PowerApps User() function not actually match what the values of the user are reported at in Office 365.

For example, in Office 365 the Author.DisplayName might “Mr X” whilst the PowerApps User().FullName reports it as “X, Me”.

If you experience this, user the Office 365 Users Connector rather than User() to get the correct matching values.

Worth testing either way...
2 REPLIES 2
Highlighted
o365masters
Level: Powered On

Re: Condition on User=Author to Hide the Delete Button (Detail Screen)

Trying adding labels to your page to show you what each of the values you are trying to compare are in fact the same. I have experienced situations in the past when the native PowerApps User() function not actually match what the values of the user are reported at in Office 365.

For example, in Office 365 the Author.DisplayName might “Mr X” whilst the PowerApps User().FullName reports it as “X, Me”.

If you experience this, user the Office 365 Users Connector rather than User() to get the correct matching values.

Worth testing either way...
Aladin
Level: Powered On

Re: Condition on User=Author to Hide the Delete Button (Detail Screen)

Hi o365masters,

 

Thanks a lot for your solution, it works indeed!

As you mentioned, I've tried to find workarounds to get matches between the various separators "," , " " etc. to deal with the User() function while the Office365.MyProfile() actually gives me eveything I need on the proper format.

 

Thanks again,

Aladin