I am trying to make a button visible only if the User().Email is matching with atleast one of the email addresses in my Sharepoint List Column called EAddress.
Please help me on this. Thanks
Try adding this to the visible property of the button.
!IsEmpty(Lookup('SPList', User().Email = EAddress))
Add a .Email to your formula.
!IsEmpty(Lookup('SJA Coating Adviser Responsible', User().Email = EAddress.Email))
This is assuming you have created your column EAddress as a Person column. If that is not the case, then reply back.
It worked out but I have given a different logic as below.
MailAdd - Single Text containing email address
usermailvar - variable set for user().email
!IsEmpty(LookUp('SJA Coating Adviser Responsible', MailAdd=usermailvar))
It shows up for my id now but i need to test with other users. when i try to remove my email from the list, the visibility is still ON. Not sure whether its a powerapps slowness to capture the update from sharepoint.
I'm not sure what you mean by you need to test with other users.
Even if you change the email address in your SharePoint list, that is not going to impact your App because it is still verifying against your email address.
If you want to test with other users, then you need to change your usermailvar to be the email addres of the other user...not your SharePoint list, as that condition will never happen.
Now, with that in mind - you might also want to change your formula to the following:
!IsBlank(Lookup('SJA Coating Adviser Responsible', MailAdd=usermailvar).ID)
IsEmpty will always return false, even if it doesn't exist. With IsBlank, you are (in this formula) checking a specific column (ID) for blank. If it's not found, then it will be blank and your formula will work.
The below code worked. However, when i add one more email address with a separator as semicolon in the list column, it seems there is a problem in looking up. Let me try again.
!IsBlank(LookUp('SJA Coating Adviser Responsible',MailAdd=usermailvar).MailAdd)
Yes, it's not going to do anything with that semicolon except be part of the original text field. Your formula will not work on that scenario.
In this case your logic will need to change. Originally it was thought that you had a list of items with an email address in it that would determine (if the email was in the list) that the button should be visible.
But, now you are indicating that the list may have multiple emails in each record.
So, the question would be, what is the record that has the information to determine this?
Are you trying to make the button visible on a record item (i.e. in a gallery) or is the button particular to the app in general.
In other words - if you are dealing with the button on a record by record basis, then your logic for determining the email address would be based on the EAddress field of the record.
If you are dealing with many records and you are trying to determine if a person is in the EAdress field...the question is - of what record?
Check out new user group experience and if you are a leader please create your group
Check out how to claim yours today!
Test your skills now with the Cloud Skill Challenge.