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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Having Issues with Nes...
Power Apps
Unanswered

Having Issues with Nested If statement in my PowerApps

(0) ShareShare
ReportReport
Posted on by 7

Hi, 

I created a PowerApp connected to the SharePoint list which on start will check if the different statuses are approved in the list. If so, based on the approval type it will take the user to an appropriate screen to fill out all the necessary details. 

The first two parts of my code work fine but the last part where it checks the Legal Approval Status is not working correctly. It won't take the user directly to Finance Screen when the Legal Approval Status is Approved. Can someone help me with what is wrong with my code?

If(
 IsBlank(Param("ID")),
 'Preliminary Screen',
 If(
 ((LookUp(
 'Software Acquisition List',
 ID = Value(Param("ID"))
 ).'Infosec Approval'.Value = "Approved") && (LookUp(
 'Software Acquisition List',
 ID = Value(Param("ID"))
 ).'IT Approval'.Value = "Approved") || (LookUp(
 'Software Acquisition List',
 ID = Value(Param("ID"))
 ).'Salesforce Approval'.Value = "Approved")) || (LookUp(
 'Software Acquisition List',
 ID = Value(Param("ID"))
 ).'Exec Approval'.Value = "Approved"),
 'LegalScreen',
 If(LookUp('Software Acquisition List', ID = Value(Param("ID"))).'Legal Approval Status'.Value = "Approved", 'FinanceScreen', 'Preliminary Screen')
 )
)

 

Categories:
I have the same question (0)
  • subsguts Profile Picture
    1,259 Moderator on at

    The portion of your code below in bold is never evaluating to "true", so it's not going to return 'FinanceScreen'.


    If(LookUp('Software Acquisition List', ID = Value(Param("ID"))).'Legal Approval Status'.Value = "Approved", 'FinanceScreen', 'Preliminary Screen')

    Therefore, I suggest you break this Lookup out separately to determine why this is the case.  

    Honestly, I don't think there is anything syntactically wrong with your code, rather, this statement is never evaluating to true.

    Hope this helps and respond with the results of testing that one Lookup as I think breaking that out will show you what's happening (that's my theory :-))

  • gkaur Profile Picture
    7 on at

    Hello, 

    I appreciate your response. 
    I tested this out and I agree that the last part of the if statement is not evaluating. The user was redirected to a different screen when the if statement evaluated false when I eliminated that statement. I don't know how to make the last part work. 

    Depending on where the user is in the approval process, I want the app's start screen to change. Upon completion of the Infosec, IT, Salesforce approval, the user is taken to the Legal screen (2nd step of approval), and if the legal approval has been completed, the user is taken to the Finance screen (last step of approval). 

    Would you be able to help me figure out how to do this?  

  • subsguts Profile Picture
    1,259 Moderator on at

    My only suggestion would be to break out each of the Lookups and store each result into it's own variable.

     

    Then you can do an If statement to determine the status and which screen the user should be directed to.  By doing it this way you can examine the return value for each of the Lookups and probably forumated an If statement that is easier to understand and also know exactly what is happening. 

    I find If statements that do a lot calculations within them make my brain hurt and hard to determining exactly where the problem is.

     

    Hope this is helpful.

  • gkaur Profile Picture
    7 on at

    Hi, 

    I tried breaking it down into variables, I even tried storing it in Collection. But, the problem is "StartScreen" property of an app won't allow me to have variables/collections. I honestly don't understand how to make this thing work. 

  • subsguts Profile Picture
    1,259 Moderator on at

    Did you try putting this in the OnStart property of the App?

  • gkaur Profile Picture
    7 on at

    Yes, I did!
    But OnStart property won't let me navigate the screen. I would need to use StartScreen Property to navigate the user to the correct screen. StartScreen property won't use any global variables/collections that I create under OnStart property.

  • subsguts Profile Picture
    1,259 Moderator on at

    Trying watching this video around the 6:30 mark:

    https://www.youtube.com/watch?v=7MxXmGOkeLQ

     

    Also, this older post I think will help you too:
    https://powerusers.microsoft.com/t5/Building-Power-Apps/App-Start-Screen-no-global-variables/td-p/1332751

     

    Hopefully one or both of these will help get you going again.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard