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 / Multiple query string ...
Power Apps
Answered

Multiple query string parameters send approver to different screens

(0) ShareShare
ReportReport
Posted on by 312

Hi there! I am working on an approval and using the formula at the bottom of this message to take an approver to review a specific record (I am sending a link from the app). I would also like to be able to send a separate link to take them straight to a gallery that I am using as a dashboard of all requests. It is on a separate screen, called scrDashboard. I believe that the formula for StartScreen should be something like,

If(Not(IsBlank(Param("ID"))), scrMainForm, If(Not(IsBlank(Param("Gallery"))), scrDashboard, scrWelcome))"

,but I can't figure out what to put OnStart to make it work! Thanks in advance!! 

 

OnStart: 

If(Not(IsBlank(Param("ID"))), Set(varRecord, LookUp(Request,ID = Value(Param("ID"))));
ViewForm(frmRequestForm))

 

StartScreen:

If(Not(IsBlank(Param("ID"))),scrMainForm,scrWelcome)

 

 

 

 

 

 

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @KBeale 

    It seems like you're trying to route users to different screens in your Power Apps Canvas App based on the query string parameters they use to access the app.

     

    You can modify the OnStart formula of your app to account for the additional parameter and the new screen. Here's how you might update your OnStart formula:

     

    If(
     Not(IsBlank(Param("ID"))),
     Set(varRecord, LookUp(Request,ID = Value(Param("ID"))));
     Navigate(scrMainForm, ScreenTransition.None),
     Not(IsBlank(Param("Gallery"))),
     Navigate(scrDashboard, ScreenTransition.None)
    )
    

     

    In this formula, we're checking if the "ID" parameter is not blank. If it's not, then we're setting varRecord to the corresponding record from the Request collection and then navigating to scrMainForm.

    If the "ID" parameter is blank but the "Gallery" parameter is not, we're navigating to scrDashboard.

    In case both parameters are blank, the formula will do nothing, and the user will stay on the current screen.

     

    Then, your StartScreen formula should be updated to handle both conditions, like you mentioned:

     

    If(
     Not(IsBlank(Param("ID"))),
     scrMainForm,
     Not(IsBlank(Param("Gallery"))),
     scrDashboard,
     scrWelcome
    )
    

     

    Here, if the "ID" parameter is not blank, the start screen is scrMainForm. If the "ID" parameter is blank but the "Gallery" parameter is not, the start screen is scrDashboard. If both parameters are blank, the start screen is scrWelcome.

     

    This should help in routing the user to the correct screen based on the parameters passed in the URL.

    Remember to run the OnStart formula after modifying it to apply the changes , like this:

    poweractivate_0-1691255080659.png

     

    Click Tree view --> App, the ellipses to the right -> Run OnStart from the menu to trigger OnStart

    Hope it helps @KBeale 

  • KBeale Profile Picture
    312 on at

    Thank you!! I was working on this in the meantime, and I was also able to accomplish it by just leaving what I had OnStart and adding what you suggested (except I decided to rename the parameter in case I wanted to use it for something else later) to StartScreen. I am still sorting out what needs to be on OnStart v. Start screen (anything involving global variables is clear, ... and commands involving the form mode - ? -or could those go on StartScreen too?)) but this works for my current requirements. Thanks again for your help! 

    If(
    Not(IsBlank(Param("ID"))),
    scrMainForm,
    If(
    Not(IsBlank(Param("openscreen"))),
    scrDashboard,
    scrWelcome
    )
    )

  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @KBeale 

    I'm glad to hear that you were able to make progress!

     

    About when to use OnStart vs StartScreen:

     

    1. OnStart: This formula is executed when the app is first launched, before any screens are shown.

    It's typically used to initialize global variables and collections, and fetch data from data sources.

    It's also used to perform actions that should only occur once during an app session, for instance, navigating to a specific screen based on parameters passed in the URL.

    2. StartScreen: This property determines which screen to show first when the app is launched. It's often set to a static screen, but you can also use it dynamically based on parameters or variables.

     

    Given this, your use of both is appropriate. OnStart is used to initialize varRecord based on the ID parameter, and StartScreen is used to navigate to the correct screen based on the parameters.

    In regards to form mode, you can set it on the OnVisible property of the specific screen where the form is located. This way, every time that screen is visited, the form mode is set appropriately. For instance, you might set frmRequestForm's DefaultMode to FormMode.Edit if a parameter is provided, or to FormMode.New otherwise.

     

    Here is a sample formula that you might use in the OnVisible property of the screen where your frmRequestForm is located.

    This should set the form to FormMode.Edit if an "ID" parameter is provided, and FormMode.New otherwise.

     

    If(
     Not(IsBlank(Param("ID"))),
     UpdateContext({ varFormMode: FormMode.Edit }),
     UpdateContext({ varFormMode: FormMode.New })
    )
    

     

    Then, in the DefaultMode property of frmRequestForm, you could simply use the varFormMode variable like so:

     

    varFormMode
    

     

    This way, every time the screen becomes visible, the form mode is set appropriately based on the "ID" parameter.

     

    Please note that UpdateContext is used to create a context variable (varFormMode in this case) that is local to the specific screen. With these kinds of variables, you should not suddenly use the Set function on these kinds of variables later, as Set is only for global variables, and UpdateContext is only for context variables. If you need the variable to be accessible globally across different screens, consider using the Set function instead of UpdateContext.

     

    Consider also using the prefix "glo" for global variables, "var" for context variables (or any naming you want that helps you differentiate the two kinds of variables at a glance).

     

    If you want to use a global variable instead of a context variable, you can use the Set function instead of UpdateContext:

     

    If(
     Not(IsBlank(Param("ID"))),
     Set(gloFormMode, FormMode.Edit),
     Set(gloFormMode, FormMode.New)
    )
    

     

    Then, in the DefaultMode property of frmRequestForm, you could use the gloFormMode variable like so:

     

    gloFormMode

     

     

    Hope it helps @KBeale 

  • KBeale Profile Picture
    312 on at

    Thanks so much for the detailed response. I'll move the form mode stuff to the screen with the form as you suggested - and pin this info so I can finally sort out OnStart/ StartScreen in my mind for once and for all 🙂 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard