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 Pages / How to request.params....
Power Pages
Answered

How to request.params.id when no GUID is in URL?

(0) ShareShare
ReportReport
Posted on by 44

As the title says how can I use

request.params.id?
Categories:
  • Verified answer
    Christian Leverenz Profile Picture
    1,214 on at

    Hi @Verceti87 ,

    the request.params collection contains the get parameters which are sent along with the request.

    so, if the url is https://<myportalurl>/<myportalpage>/?a=42&vegetable=cucumber&cid=01234567-abcd-bcde-cdef-0123456789ab the request.params collections can be accessed like this:

    {% assign mya = request.params["a"] %} {%- comment -%}mya will contain 42 (as a string) now{%- endcomment -%}

    {% assign myvegetable = request.params["vegetable"] %}{%- comment -%} myvegetable will contain the string cucumber{%- endcomment -%}

    {% assign mycid = request.params["cid"] %}{%- comment -%} mycid will contain the string 01234567-abcd-bcde-cdef-0123456789ab{%- endcomment -%}

    So, using request.params.id does not really make sense when the url does not contain a get parameter called id,

    You can check the presence of the id by {% if request.params.id %} . May colleagues prefer {% assign myid = request.params.id | default: "noidpresent" %} and then somewhere in the code {% if myid = "noidpresent" %}...{% else%}...{%endif%}

    Its a matter of taste and style 🙂

    Hope this helps and is the answer to the question 🙂

       Christian

     

    PS i never checked what happens if you pass in ...&a=1&a=2&a=3. I think, in asp.net you would get an array as parameters. But i never tried in portals. When i want wo pass in many values i usually use somtehing like ...&a=1,2,3 and somewhere in the code {% assign myas = request.params.a | split: "," %} to get an iterable for the a's  🙂

     

  • Verceti87 Profile Picture
    44 on at

    @chleverenzThank you for the explanation.

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

Leaderboard > Power Pages

#1
Mohsin Ali Profile Picture

Mohsin Ali 18

#2
11manish Profile Picture

11manish 14 Super User 2026 Season 2

#3
Harshit Chaubisa Profile Picture

Harshit Chaubisa 4

Last 30 days Overall leaderboard