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:
I have the same question (0)
  • 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

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!

Leaderboard > Power Pages

#1
DP_Prabh Profile Picture

DP_Prabh 29

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 25 Most Valuable Professional

#3
Hammed Profile Picture

Hammed 22

Last 30 days Overall leaderboard