Skip to main content

Notifications

Community site session details

Community site session details

Session Id : xiKds1ZTfBVt5D+BCE+GR0
Power Apps - Building Power Apps
Unanswered

How to Set and Pass Param in Power Apps

Like (0) ShareShare
ReportReport
Posted on 29 Jul 2022 23:49:38 by 4,704 Super User 2025 Season 1

I am still trying to understand how to pass a Parameter between SharePoint and Power Apps.

I am practicing on a ChatGallery. I've got everything work except the Parameter referenced below.

I don't under the instruction, or where or how to implement the Param() recommendation. 


I do have the app link from Details, I just don't know what to do with it and how.

I have the referenced Set Param code in my OnStart.

 

Phineas_0-1659138007829.png

 

I've done the below and I can see the first item from the List in the Collection and it appears in my ChatGallery. I just don't know how and where to make the change so that ALL the entire ChatLog (List) comes through, or what should come through based on the Param "itemID" formula.

 

Phineas_1-1659138207939.png

 

Categories:
  • Community Power Platform Member Profile Picture
    on 20 Apr 2023 at 18:07:50
    Re: How to Set and Pass Param in Power Apps

    Hi @RusselThomas,

    Could you please give a minute to this post Navigate to specific screen in powerapps with push... - Power Platform Community (microsoft.com)

    Regards 🙂

  • RusselThomas Profile Picture
    4,012 on 05 Apr 2023 at 08:43:18
    Re: How to Set and Pass Param in Power Apps

    Hi @nnikyta ,

    Pretty odd as I don't see a global variable there....  The short answer is that you can't use global variables in the StartScreen property, but you could possibly work around it with an expression variable using the With() function.

     

    But, like I said, there's no global variables in that expression, so I'm not sure why it's popping that up....

    Is that all the code you're running in the StartScreen property?

     

    Kind regards,

    RT

  • nnikyta Profile Picture
    4 on 05 Jan 2023 at 14:44:07
    Re: How to Set and Pass Param in Power Apps

    Hi RusselThomas,

     

    I'm getting "Global variables are not allowed in StartScreen" error when trying to use your method. Usually my StartScreen would be:

    If(!IsBlank(Value(Param("itemID"))), 
    //there is a value for itemid in the url so navigate directly to the form page on start
     formViewScreen,
    //otherwise if there is no parameter specified, just load the normal start screen
     HomeScreen
    )

    Any tips on how to get Global variables working with StartScreen?

  • RusselThomas Profile Picture
    4,012 on 30 Jul 2022 at 15:57:10
    Re: How to Set and Pass Param in Power Apps

    Hi @Phineas ,

    Sorry, I've never used the chat log, perhaps someone else who has might be able to shed some light on it?

    Kind regards,

    RT

  • Phineas Profile Picture
    4,704 Super User 2025 Season 1 on 30 Jul 2022 at 14:50:42
    Re: How to Set and Pass Param in Power Apps

    Mr. Thomas:

    Thank you for your time and detail; Very useful.

    If you can tell, how does the Param function impact the Chat log? When I put in a number I get that one item when the List 'ID' matches that number.

    When I use the Set(itemID... with the List itemID determined as "1"), I get the item on the List associated with ID "1".

    When I just use the Set (item...with out the "1") I don't get anything returned.

    How does the Param() help me get back all the data. I don't want to control what screen opens, I just want to understand what the author was intending using the Param function in relations to the content of the Collection at App OnStart.

    Or, if I even need the Param function; Can I just call all the data back and filter it however I choose?
    Param("itemID")



  • RusselThomas Profile Picture
    4,012 on 30 Jul 2022 at 14:12:15
    Re: How to Set and Pass Param in Power Apps

    Hi @Phineas ,

    Parameters are passed in the URL once, when the app launches.

    The idea with parameters is that sometimes you want to add some context to an app launch, instead of just launching it to the standard landing page. 

     

    For example let's say you have a landing page where the user is presented with a navigation menu.  They can go look at a few screens, one of which contains gallery of items and if they select an item it takes them to a page where they can view an item.

    Now, let's say you have some automation that sends the user an email when an item changes, saying "something happened, click here to go see it" with a link to your app - except you want to take your user straight to the item view page, so they don't have to start at the home page and then click through everything and go find that item - because the 'context' of their email is that a specific item changed.

    This is where query parameters become handy.  

     

    If you control the email you send to them, you control the link for them to click which will launch the app, meaning you can pass information to the app inside the URL - a query parameter is a variable contained within the URL of the link - for example "name=Bob" or "myVar=something" or "itemID=23". 

    Query parameters have been around long before PowerApps came along.  To understand a bit more, it helps to understand how they are constructed.

     

    Query parameters can be added to a web address to pass information along to a resource listening at that address.

    For example;

     

    https://www.somwebsite.com

     

    is a URL.  If there was a web service or something at that URL that understood some parameters, you might see an address like;

     

    https://www.somwebsite.com?name=Bob

     

    Query parameters in URL's are universally recognised as starting with ?

    Additional parameters are added using &

     

    https://www.somwebsite.com?name=Bob&myVar=something&itemID=23

     

    note the placement of the ? and the subsequent &'s

     

    PowerApps are web apps, and so they can run in a browser - when you click on a power app to run it, you are activating a link.  This link you've already found in app details.

    If you look closely, your PowerApp probably already has a parameter, like "tenandId" eg:

     

    "https://apps.preview.powerapps.com/play/some-long-App-identifier?tenantId=some-long-tenant-identifier" 

     

    This link will launch your app - so if you copy and paste that link into an email and send it to someone and they click the link or copy and paste it into their browser - and it will launch your app.

    Using this capability you can add parameters to that link by editing it in the email before you send it - just keep the original address as is, and (because "tenantId" has already started the query with ?), append your parameters to the address using & - like so;

    https://apps.preview.powerapps.com/play/some-long-App-identifier?tenantId=some-long-tenant-identifier&name=Bob&myVar=something&itemID=23

    Now that you have an app URL that is loaded with parameters, you have to tell your app what to do with them.

    On the app side, you use the Param() function to pick up those parameters and use them in your app - typically by referencing them directly, or assigning them to variables - for example in your app OnStart: property;

     

    Set(varName = Param("name"))
    //or
    Set(varMyVar = Param("myVar"))
    //or
    Set(varItemId = Value(Param("itemID")))

     

    note that parameters always come through as text, because they are part of a text string which is the URL.  If itemID needs to be a number in your app, you have to convert it with something like the Value() function.  

    You can then use this information in your App - for example in OnStart: or StartScreen: properties, let's say we want to send the user straight to the form view page to view that specific itemID when they click our custom URL;

    Assuming the above already exists in your app OnStart: property, then this could go into your StartScreen: property;

     

    If(!IsBlank(varItemId), 
    //there is a value for itemid in the url so navigate directly to the form page on start
     formViewScreen,
    //otherwise if there is no parameter specified, just load the normal start screen
     HomeScreen
    )

     

    Then your Form Item: property can be set to reflect the specific record specified

     

    LookUp(mySource, ID=varItemId)

     

    There are 100 different ways you can use this to affect the user experience depending on how they launch the app - the basic principle however is pretty simple;

    This only works when launching an app from a custom link that you create.  The link can be activated from any mechanism that opens websites from a link (there are 100's of ways to do this - Email link, website, Launch() function in one PowerApp to open another PowerApp, Teams link, IM, SMS etc.) - as long as it's your custom link and not the native app launch from the library, because then it's using the default link which contains none of your parameters. 

    Hope this helps,

    RT

     

     

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started