Making the Right Choice: Session Storage or Local Storage in Power Pages
Step 1: Pre-Outline Brief
Target Audience:
- -Power Platform consultants
- -Power Pages (Power Apps Portals) developers
- -Dynamics 365 functional/technical consultants
Purpose:
To clarify when to use session storage vs local storage in Power Apps Portals, using a real-world use case: syncing customer dropdown selection across pages in a portal.
Pain Points Solved:
- -How to persist values (like selected customer) across pages in Power Apps Portals
- -When to use sessionStorage (short-lived values) vs localStorage (long-lived values)
- -Avoiding user confusion when data doesn’t sync between Dashboard and other pages
Step 2: Core Content
Scenario Overview
I was working on a customer dropdown inside a Power Apps Portal (Dashboard). When a customer was selected, I wanted:
- The selected customer to reflect automatically on other pages (like Contracts).
- If a customer is selected from another page, the change should reflect back in the Dashboard.
This brought up the key question: “Should I use session storage or local storage?“
Understanding Session Storage vs Local Storage
Before diving into the solution, let’s break down the difference:
🔹 Session Storage
- -Lives only for the duration of the browser tab.
- -Cleared automatically when the tab or browser is closed.
- -Perfect for temporary selections, like filters, dropdown choices, or values that reset on logout.
- -Access:
sessionStorage.setItem("key", "value"); // Save
sessionStorage.getItem("key"); // Retrieve
sessionStorage.removeItem("key"); // Remove
🔹 Local Storage
- -Data persists even after closing/reopening the browser.
- -Remains until explicitly cleared by the user or application.
- -Great for preferences (like dark mode, saved filters, or language selection).
- -Access:
localStorage.setItem("key", "value"); // Save
localStorage.getItem("key"); // Retrieve
localStorage.removeItem("key"); // Remove
Key difference:
- -sessionStorage = short-lived, per session
- -localStorage = long-lived, survives browser restarts
Problem Statement
When building multi-page Power Apps Portals, we often need to carry user selections (like Account/Customer IDs) across pages.
- -Query strings (
?accountId=...
) are not always reliable. - -Cookies can be inconsistent depending on browser settings.
- -We need something simpler: Web Storage APIs (sessionStorage vs localStorage).
But which one should we use?
Initial Approach and Issue
I first used localStorage for the customer selection. While it worked across pages, it had one drawback:
- -If the user signed out and came back, the old customer selection persisted, even though the session should have been cleared.
This confused users because they expected a “fresh start” after logging back in.
Working Solution: Using Session Storage
The best solution was to use sessionStorage:
- -Store the currently selected
accountId
in sessionStorage. - -Automatically sync the value across pages (Dashboard, Contracts, etc.).
- -On sign-out, sessionStorage clears automatically — no extra cleanup needed.
Power Apps Portal Code Example
1. Store customer selection in sessionStorage (Dashboard page):

2. Apply selection on another page (e.g., Contracts page):

3. Clear selection on Sign Out (SignIn page):

Benefits of This Approach
- –Session-based persistence: Values survive navigation but clear on sign-out/close.
- –Lightweight & browser-native: No dependency on cookies or external storage.
- –User-friendly: Users don’t see “stale” selections after signing out.
- –Flexible: Can extend to local Storage if long-term persistence is required.
In Power Apps Portals, deciding between sessionStorage and localStorage depends on user expectations:
- 1. Use session storage when you want selections/values to clear automatically after logout or browser close.
- 2. Use local storage when you want to persist user choices across sessions.
In my customer dropdown scenario, sessionStorage was the clear winner, as it ensured selections synced across pages but reset cleanly at logout. Sometimes, it’s not about picking one — but knowing when to use both to balance persistence with user experience.
Need help implementing storage logic in your Power Pages?
Reach out to CloudFronts Technologies as I’ve already implemented this use case for syncing dropdowns between Dashboard and childpages in a Portal website. You can contact us directly at transform@cloudfronts.com.