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 / Passing parameters via...
Power Pages
Suggested Answer

Passing parameters via URL to multi-step form power page

(1) ShareShare
ReportReport
Posted on by 32
Dear community,
 
I am fairly new to power pages.  I have tried a 1000 ways to pass a parameter to a multi-step form either as custom scripts or via additional settings in the form to no avail.
 
First, is it possible = i.e., https:// ... ?sharepointID=xxxxx ...
 
If so, how do I pre-populate the text field?

Thank you in advance, JS
Categories:
I have the same question (0)
  • Suggested answer
    rezarizvii Profile Picture
    70 on at
    Hi, hope you are doing well.
     
    It is absolutely possible to pass query parameters to a form and then read the parameter to implement a custom business rule. I have done it plenty of times, and it is why it's recommended to have your forms on a separate page, so you can leverage the power of custom query parameters.
     
    Step-by-step:
    1. Pass the parameter in the URL
      Set the parameter in the URL on click of a button (or whatever it is that you are using to navigate the users to the multi-step form page). 
    2. Add Custom JS to the form step
      Go to:
    • Power Pages Management app
    • Open your Multi-step Form Step
    • In Additional Settings -> Custom JavaScript, add:
    (function () {
        function getParameterByName(name) {
            const url = window.location.href;
            name = name.replace(/[\[\]]/g, '\\$&');
            const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
            const results = regex.exec(url);
            if (!results) return null;
            if (!results[2]) return '';
            return decodeURIComponent(results[2].replace(/\+/g, ' '));
        }
        const value = getParameterByName('sharepointID');
        if (value) {
            $('#yourfieldlogicalname').val(value);
        }
    })();
     
    3. Use the correct field name
    Replace yourfieldlogicalname with the actual field name rendered on the form
     
    That’s all you need, no special configuration beyond the JS.
     
    If this reply helped you in any way, please give it a Like 💜 and in case it resolved your issue, please mark it as the Verified Answer ✅.
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,449 Most Valuable Professional on at
    My initial question here is how do your Multistep Form starts? is it a new session always? or would it be an existing session?
     
    Also, where is the information coming from before sending to the multi step form?
     
    at a high-level, you will need:
    • add JS logic to the page before starting the multistep form
      • this could be a list/subgrid/page/form/etc
      • inject the information you need to the URL
    • then on the multistep form itself
      • you can read the params via either form configuration or JS
     
     
    but it's been a while, so let me know if you need further info
  • Suggested answer
    wiredupmax Profile Picture
    32 on at
    Ok, I finally got it to work using Claude. I had to use a "delay" because when the multi-form paints the page, it wipes out the field.

    Code =
     
    (function () {
        function getParameterByName(name) {
            const url = window.location.href;
            name = name.replace(/[\[\]]/g, '\\$&');
            const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
            const results = regex.exec(url);
            if (!results) return null;
            if (!results[2]) return '';
            return decodeURIComponent(results[2].replace(/\+/g, ' '));
        }
    
        $(document).ready(function () {
            setTimeout(function () {
                const value = getParameterByName('sharepointid');
                if (value) {
                    $('#xxxxxxxxx_sharepointid').val(value);
                }
            }, 500);
        });
    })();
     
  • Suggested answer
    oliver.rodrigues Profile Picture
    9,449 Most Valuable Professional on at
    strange that you needed the timeout, technically the Document Ready should load only after the page is loaded
     
    I would use a native JS function called URLSearchParams instead of reading the entire URL URLSearchParams: get() method - Web APIs | MDN
     
    but anyway, if it's working the way it is that's probably enough 

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 41

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 31 Most Valuable Professional

#3
Hammed Profile Picture

Hammed 22

Last 30 days Overall leaderboard