cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SH14
Regular Visitor

IsBlank Lookup Function returns incorrect value after certain time period or refreshing the app

Good Afternoon All, 


I use Edge in private mode to create Apps using Power Apps. First time PowerApp builder and poster. I am having a very odd issue. In my New Starter Power Apps Forum I have an objective to show certain cards properties as DisplayMode = view only or Visibility = false. This condition depends on the User().email that is detected whilst PowerApp is open. If the person logged into or using the App fall into a certain group they can only view certain Text inputs and other Text labels and Text inputs are hidden all together.

I have a SharePoint list called “New Starter Form Access". In the list it has three columns with three entries (rows).

* Title (Single line of text) description of the group

* Approval Level (Choice) selection of HR, Line Manager and IT

* Group (People or Group) selection of Office365 security groups for people. HR Line Manager and IT

The Power Apps form uses this SharePoint list as data connections.

In the Power Apps itself I have the App on Startup property use the following formula. The first three "Isdepartment" is the actual code I used. Me using powerapps and previewing the App should detect that I am part of IT. As a result the Lookup should return as false because I have a record email which matches User().email  in "New Starter Form Access" list under the column "group" for group IT.

Set(currentUser, User());

Set(isIT , IsBlank(LookUp('New Starter Form Access', 'Group (Group0)'.Email = currentUser.Email && 'Approval Level'.Value = "IT" ))); //false

Set(isHR , IsBlank(LookUp('New Starter Form Access', 'Group (Group0)'.Email = currentUser.Email && 'Approval Level'.Value = "HR" ))); //true

Set(isLM , IsBlank(LookUp('New Starter Form Access', 'Group (Group0)'.Email = currentUser.Email && 'Approval Level'.Value = "Line Manager" ))); //true


This is another formula I had tried and had the same issue. It worked originally and then stopped after reloading the page / coming into work the next day / or after a couple of hours. 

Set(VarLookupUser, IsBlank(LookUp('New Starter Form Access', 'Group (Group0)'.Email = User().Email))); // FALSE This is comparing any entries in SharePoint List group column to see if any email entries that equal currently logged in users Email. The IsBlank function tests for a blank value or an empty string returns boolean true or false. If I am logged into the PowerApps it should return false because I am listed in the Groups column for New Starter Form Access list so the returned value for IsBlank is false.

Then depending on the field 

For Visibility property for datacards I have the following formula 

isIT



For DisplayMode for datacards I have the following formula 

If(!IsBlank(VarLookupUser),DisplayMode.View,DisplayMode.Edit)// IsBlank is false user can edit

To try and understand what was happening in the logic I created some validation fields in the form. 

Display User.()email
Display if User.()email was the same as xxxx@xxx.com and out detected or not detected
Display The value of IsBlank for VarLookupUser

Display The value of IsBlank for IsHR
Display The value of IsBlank for IsLM
Display The value of IsBlank for IsIT

I had noticed when I first enter the formula's for OnStartup for App property the Value of the Variable's IsBlank is what I would expect 

For Me it should 

value of IsBlank for VarLookupUser = false

value of IsBlank for IsHR = true
value of IsBlank for IsLM = true
value of IsBlank for IsIT= false


As my email is in listed in IT Group for the SharePoint list for both IsIT and VarLookupUser. 

However, they are all now showing as 

value of IsBlank for VarLookupUser = true

value of IsBlank for IsHR = true
value of IsBlank for IsLM = true
value of IsBlank for IsIT= true

Meaning that its not detecting my users email when looking up in the SharePoint list. Its odd how it works the first time I code the formula then after certain time elapses or I reload the page It for myself IsBlank is being detected as true. Its also like the detection is not being run correctly / is cached or not able to find the entries. Any suggestion would be greatly appreciated. 



 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @SH14 

 

After reading thru all of this, I have some questions.

 

1) When is this code being called to set the "isIT","isHR","isLM"? Is it called from "App" - "OnStart" or a button click? While troubleshoot, try placing the code in "OnSelect" of a button on the Form you are displaying the values on.

 

2) How are the People Picker fields set up in your New Starter Form Access list? Are you allowing Groups? Or are you limiting it to "People Only".

MarkBandR_0-1718377024295.png

You should be using "People Only" as the comparison for "'Group (Group0)'.Email = currentUser.Email" will not work with a group. I just want to verify that you were not expecting that Power Apps would check that a user is a member of a group if a group is selected for the People Picker.

 

2) Could your variables be getting set or reset from code some where else in the App? Use the Search to find all instances or references to "currentUser", "isIT", "isHR", and "isLM".

MarkBandR_2-1718377528018.png

 

This is a very strange issue you are having.

 

-Mark

If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up.

 

View solution in original post

8 REPLIES 8

Hi @SH14 

 

I think your IsBlank logic is backwards. Try:

 

Set(isIT , !IsBlank(LookUp('New Starter Form Access', 'Group (Group0)'.Email = currentUser.Email && 'Approval Level'.Value = "IT" ))); 
Set(isHR , !IsBlank(LookUp('New Starter Form Access', 'Group (Group0)'.Email = currentUser.Email && 'Approval Level'.Value = "HR" ))); 
Set(isLM , !IsBlank(LookUp('New Starter Form Access', 'Group (Group0)'.Email = currentUser.Email && 'Approval Level'.Value = "Line Manager" ))); 

 

You should have "!" in front of the "IsBlank" to effect "Not".

 

-Mark

If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up.

hey @SH14 

 

can u try this:

Set(isIT, IsBlank(LookUp('New CMS Starter Form Access', 'Group (Group0)'.Email = currentUser.Email && 'Approval Level'. Value = "IT")));

 

Let me know if my answer helped solving your issue.

If it did please accept as solution and give it a thumbs up so we can help others in the community.



Greetings

Thank you for the suggestion. I have tried changing to !IsBlank and copying your code / replacing mine. However  it also does not produce the correct result. It changes all the variable test output from True (using IsBlank) to all being False (using !IsBlank)

 

 

value of IsBlank for VarLookupUser = false

value of IsBlank for IsHR = false

value of IsBlank for IsLM = false

value of IsBlank for IsIT= false

 

When I run the PowerApp in editor mode. Select App in tree view > right click > run on start you can see sometimes for a split second it will change to the correct values then change to the incorrect values. This seems to happen when using !IsBlank or IsBlank. Which reflects my earlier point that the code seems to work until the form is reloaded or certain amount of time as elapsed then it just stops working.

 

 

value of IsBlank for VarLookupUser = true

value of IsBlank for IsHR = false

value of IsBlank for IsLM = false

value of IsBlank for IsIT= true 

 

OR

 

 

value of IsBlank for VarLookupUser = false

value of IsBlank for IsHR = true

value of IsBlank for IsLM = true

value of IsBlank for IsIT= false

I have created another column in my SharePoint list with just people rather then groups and see if that makes any difference referencing people rather then groups.

Thank you for your suggestion - I have tried your code removing the "CMS" section to the SharePoint list. Unfortunately I still get the same incorrect results with all users being displayed as true. 

hey @SH14 

 

thanks for trying. can u give this modification a chance:

Set(isIT, Not(IsBlank(LookUp('New Starter Form Access', 'Group'.Email = User().Email && 'Approval Level'.Value = "IT"))));

 

Let me know if my answer helped solving your issue.

If it did please accept as solution and give it a thumbs up so we can help others in the community.



Greetings

Hi - Thank you helping with this with that amendment I still get the same issue.

I had to change your code slightly because this section 

 'Group'.Email 

Was not being recognised so changed to what I had 'Group (Group0)'.Email. The Group0 I will look into to see what that is referencing. It came up with the auto filler for the formula.

As you can see the amended code is below 

SH14_0-1718354935580.png

And you can see in the output everything is false on the validation. IT should be different to both HR and LM

SH14_1-1718355105908.png

 








Hi @SH14 

 

After reading thru all of this, I have some questions.

 

1) When is this code being called to set the "isIT","isHR","isLM"? Is it called from "App" - "OnStart" or a button click? While troubleshoot, try placing the code in "OnSelect" of a button on the Form you are displaying the values on.

 

2) How are the People Picker fields set up in your New Starter Form Access list? Are you allowing Groups? Or are you limiting it to "People Only".

MarkBandR_0-1718377024295.png

You should be using "People Only" as the comparison for "'Group (Group0)'.Email = currentUser.Email" will not work with a group. I just want to verify that you were not expecting that Power Apps would check that a user is a member of a group if a group is selected for the People Picker.

 

2) Could your variables be getting set or reset from code some where else in the App? Use the Search to find all instances or references to "currentUser", "isIT", "isHR", and "isLM".

MarkBandR_2-1718377528018.png

 

This is a very strange issue you are having.

 

-Mark

If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up.

 

SH14
Regular Visitor


1) The Set variables with the Lookup condition is set during the App > “OnStart” property

 

2) The “Group” column for SharePoint list for the “New Starter Form Access” uses the following properties

  • Allow selections of = “People and Groups”
  • Choose from = “All users”

So, these are the same settings you have mentioned in your post.

 

3) The variables are not being reset from else where in the App. I have searched for all the Set instances.



Solution

I did some testing on the Friday with a colleague, and we had come to a similar conclusion as you have mentioned. Apologies for not posting sooner.


Instead of using groups I changed the SharePoint List to include individual users under the “Group” column instead of the groups (New Starter Form IT Group, New Starter Form Line Manager Group and New Starter Form HR Group). To identify if it was an issue with using groups.

The same formula then kicked in and started to work as expected. The validation fields all showed the correct result whilst I was signed into PowerApps.

IsHR !IsBlank = false

IsLM !IsBlank = false

IsIT !IsBlank = true


I thought when using these Microsoft 365 groups the formula was checking for an email against current users email in the group for the “Groups” column.

However, if it’s a group it may have been looking at the groups email (New Starter Form IT Group, New Starter Form Line Manager Group and New Starter Form HR Group) rather than a member of the groups email.

This was possibly the root cause. Hence changing it from a group to individual user worked.


Now that you have said

“You should be using "People Only" as the comparison for "'Group (Group0)'.Email = currentUser.Email" will not work with a group. I just want to verify that you were not expecting that Power Apps would check that a user is a member of a group if a group is selected for the People Picker.”

 

This has solidified my theory. I’m guessing there is no way to compare within a group for the code to Lookup against a “person/member within a group” rather than I think what the code was saying “look up a group”.

 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (950)