web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - Design & Build
Answered

How to programmatically change the current step of a Power Pages multi-step form session?

(0) ShareShare
ReportReport
Posted on by 52
Hi all,

I’m working with a multi-step form on Power Pages and I’ve run into an issue with step navigation. The form creates a session record in Dataverse (adx_webformsession) to track the current step for each user.
I want to allow users to jump to a specific step by clicking a button, but there are limitations:
 
  • Changing the step via the URL doesn’t work, because the portal always follows the step stored in the session.
  • Attempts to update adx_webformsession through the Portals Web API are blocked. The portal returns an error indicating that this table is not supported for direct edits.
From my research, the only officially supported way to update the current step is through server-side operations in Dataverse, such as using Power Automate or a backend script. This allows the session step to be updated safely without breaking the portal logic.

I’m curious if anyone has successfully implemented a pattern that allows users to jump between steps in a multi-step form without causing session issues.
Specifically:
  • Is there a supported way to let users navigate freely between steps?
  • Has anyone used Power Automate to dynamically update the session’s step, and if so, how did you manage timing and page reloads?
Any guidance or examples would be really appreciated.

Thanks!
Categories:
I have the same question (0)
  • Verified answer
    Jerry-IN Profile Picture
    267 on at
    How to programmatically change the current step of a Power Pages multi-step form session?
    Hello  ,
     
    Thanks for raising this question. Programmatically changing the current step in a Power Pages multi-step form is not directly supported via client-side (Web API blocked for adx_webformsession) or URL params (session overrides), as the portal enforces session state for consistency. The recommended pattern uses server-side Dataverse operations (e.g., Power Automate flow) to update the session record safely, avoiding UI breaks—trigger via custom button JavaScript and page refresh. This allows "free navigation" with proper history tracking. Here's a concise implementation:


    Step-by-Step Setup

    1. Create Custom Button in Power Pages:

       - In Power Pages Studio > Edit form > Add custom button (e.g., "Jump to Step 3").

       - OnClick JavaScript:
     
    // Collect step target from user input or hardcoded
    var targetStep = 3;  // Or get from dropdown
    
    // Call Power Automate flow via Web API
    var sessionId = "{{{adx_webformsession.adx_webformsessionid}}}";  // Liquid for session ID
    fetch("/_api/webformsessions(" + sessionId + ")/Microsoft.Dynamics.CRM.UpdateStep", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ targetStepIndex: targetStep })
    })
    .then(response => {
        if (response.ok) {
            location.reload();  // Refresh to load new step
        } else {
            alert("Step change failed");
        }
    });
    
       - This invokes a custom action (step 2) to update session.
     
    2. Create Dataverse Custom Action (Plugin/Flow):

       - In Power Apps maker portal > Solutions > New > Custom action (or Cloud flow: Instant, trigger "Power Virtual Agents" for API).

       - Input: targetStepIndex (Integer).

       - Logic (in C# plugin or flow steps):

         - Retrieve adx_webformsession by ID (InputParameter).

         - Update adx_currentstepindex = targetStepIndex.

         - Append to adx_stephistory JSON (e.g., add {step: targetStepIndex, timestamp: now}).

         - Validate: Ensure step exists in adx_webformstep (query by adx_webform/adx_stepnumber).

         - Return success.

       - Register as global action; expose via Web API endpoint.
     
    3. Handle Timing and Reload:

       - Post-update: In JS, use `setTimeout(() => location.reload(), 500)` for async flow (Dataverse update ~200ms).

       - Preserve data: Before jump, save current step fields to session entity (adx_stepdata JSON) via form OnChange.

       - UI: Show step progress bar with clickable steps (update targetStep dynamically).
     
    Considerations

    - Supported Navigation: This keeps session integrity (history, validation)—users can jump freely if steps allow (set "Move Previous Permitted" True in adx_webformstep).

    - Limitations: Flows/plugins add 1-2s latency; test for concurrent users. No client-side override possible.

    - Testing: Use browser dev tools > Network to monitor API call; ensure flow runs under portal user context (impersonation if needed).

    - Alternatives: Single form with Liquid tabs (hide/show steps via JS/CSS) for simpler "jumps," but loses multi-step session tracking.

    This pattern works reliably implement the custom action first. If it helps accpet the answer.
     
     
    Best Regards,  

    Jerald Felix
  • Arjan Profile Picture
    52 on at
    How to programmatically change the current step of a Power Pages multi-step form session?
    Thank you for answering the question and taking the time to even post the automate flow! 

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

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 64

#2
Fubar Profile Picture

Fubar 46 Super User 2025 Season 2

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 27 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics