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 Apps / QuickViewControl getVa...
Power Apps
Suggested Answer

QuickViewControl getValue() returns null when isLoaded returns true - MDA form

(1) ShareShare
ReportReport
Posted on by 11
It is strongly implied that you can retrieve the value of a quick view attribute if isLoaded() returns true, however in my project it is not working.
 
const instQv = formContext.ui.quickForms.get("MyQvName");

        if (instQv.isLoaded()) {
            const attr = instQv.getAttribute("myAttrName");
            const val = countryAttr?.getValue(); // returns null
        }
 
If I open up my form, run the code above, isLoaded() will be true, but getValue will be null. Visually I can see the QV loaded, with the attribute I am after.
If I then switch forms, and run the exact same code, getValue() will return the value I am expecting. If I then swap back and forth between the forms, the code will continue to return the expected value. However, as soon as I do any kind of hard refresh, it will go back to returning null until a form is swapped. The order of loading the forms is not relevant (I.E both forms return null on initial load), simply the act of switching from one from to another is enough to have the code return a value (in my case both forms contain the QV with the same name, and value). Isloaded() always returns true.
 
 
The documentation is not perfectly explicit, but is this expected behavior? The documentation and examples are exactly what I am looking to do, and it strongly implies that if isLoaded() is true, then the values should be binded / accessible.
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
     
    This is actually expected and not something you can get around without building in your own retry logic. The issue is all of this loads Async, so you are effectively being told its loaded, but the data itself is not fully populated. It's purely a timing issue and the fact that what you are being told is "true" is true.
     
    It's like saying is my excel spreadsheet loaded yes. I can see it.
    Is my data refreshed and ready to be accessed? No.
     
    That is why its not working how you expect.

    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
  • Suggested answer
    Ram Prakash Duraisamy Profile Picture
    5,877 Super User 2026 Season 1 on at
     
    You can able to achieve this by using TIMEOUT function ( Note: Its not recommended)

    Function getValues(formContext){
    Const timeout = setTimeout( () => {
    },300);
    }

    I Suggest instead of using or getting the values form Quick View, you can use simple ODATA Call and get the values easily.

    Sample code from my Blog : https://microsoftcrmtechie.blogspot.com/2025/01/how-to-retrieve-records-using-fetchxml.html

     
    Please mark as answer if my suggestion helps.
    Subscribe here for More Useful videos : https://www.youtube.com/@rampprakash3991
  • CU11061509-0 Profile Picture
    11 on at
     
    I don't believe this is a timing or even async issue as this is reproducible via the browser console, regardless of how long the page has been active. isLoaded() will continue to return true via the browser console, however the value of the field will be null, regardless of what actions I take on the page, scrolling, waiting, etc. I can also see the value visually on the screen during this entire time, so clearly it is populated in some way. The only action I've found which populates the value from the API side, is switching forms (which will then persist through page reloads, navigating away, etc.). No amount of retry or waiting will solve this particular issue.
     
    The code I wrote is already falling back to a dataverse query, but ideally if the value is already on the page we can avoid a network request. I used to fallback on isLoaded being false, but it looks like this function can't be trusted.
     
     
    This to me seems like a bug, or at the very least documentation that should be updated, as I am doing exactly what the example is doing, and the documentation has zero warning that this is expected behavior.
  • Michael E. Gernaey Profile Picture
    53,963 Moderator on at
    Totally agree its not the best behavior @CU11061509-0
  • Suggested answer
    Assisted by AI
    VASANTH KUMAR BALMADI Profile Picture
    322 on at

    You’ve hit a real (and very poorly documented) quirk of Quick View Forms, and yes — what you’re seeing is expected behavior, even though the documentation strongly implies otherwise.

    Short version:

    isLoaded() only tells you the Quick View UI is loaded, not that its data is bound and available to the client API.

    That distinction is the root of the problem.

    What’s actually happening (important)

    What isLoaded() really means

    quickForm.isLoaded() returns true when the Quick View frame is rendered, not when the underlying Dataverse data has been hydrated into the form context.

    So this sequence is completely valid (and common):

    1. Main form loads

    2. Quick View frame loads → isLoaded() === true

    3. Quick View data binding happens later (async, internal)

    4. Attribute values become available only after binding completes

    The API does not expose an event for step 3.

    Why switching forms “fixes” it

    When you switch forms:

    • the form context is reinitialized

    • Quick View binding completes earlier in the lifecycle

    • attributes are now cached in memory

    • getAttribute().getValue() suddenly works

    That’s why:

    • first load after hard refresh → null

    • after any form switch → works forever (until refresh)

    This is not related to caching bugs or your code — it’s a lifecycle timing issue.

    Why the documentation is misleading

    The doc you referenced strongly implies:

    If isLoaded() is true, attributes are accessible.

    But in reality:

    • isLoaded() ≠ data-ready

    • it only means rendered

    • no guarantee of attribute hydration

    This has been raised multiple times internally and in the community — but the docs have never been corrected.

    So yes: the behavior you’re seeing is expected, even though the docs suggest otherwise.

    Why getAttribute() returns null

    Two separate things can be true at the same time:

    • The Quick View visually displays the value

    • The attribute does not exist yet in the client-side attribute collection

    Quick View Forms do not participate in the main form’s attribute lifecycle the way regular fields do.

    They are effectively:

    • iframe-backed

    • async-loaded

    • partially isolated

    What does not work (and never will)

    Just to save you time:

    • isLoaded() checks

    • ❌ polling in a tight loop

    • setTimeout(0) / setTimeout(100)

    • onLoad of the main form

    • ❌ moving the code to different events

    None of these guarantee data binding.

    Supported and reliable workarounds

    ✅ Option 1 (recommended): Read from the source entity, not the Quick View

    If you know:

    • the lookup on the main form

    • the attribute you want from the related record

    Then retrieve it directly:

    const lookup = formContext.getAttribute("lookupfield").getValue();
    if (!lookup) return;
    
    const id = lookup[0].id.replace(/[{}]/g, "");
    
    Xrm.WebApi.retrieveRecord(
        lookup[0].entityType,
        id,
        "?$select=myAttrName"
    ).then(r => {
        const val = r.myAttrName;
    });
    

    ✔ deterministic
    ✔ supported
    ✔ no timing issues
    ✔ works on first load

    This is Microsoft’s actual recommended pattern, even though it’s rarely stated explicitly.

    ✅ Option 2: Defer execution using a delayed retry (pragmatic)

    If you must read from the Quick View:

    function tryGetQuickViewValue(qv, retries = 5) {
        const attr = qv.getAttribute("myAttrName");
        const val = attr?.getValue();
    
        if (val !== null) {
            return val;
        }
    
        if (retries > 0) {
            setTimeout(() => tryGetQuickViewValue(qv, retries - 1), 300);
        }
    }
    

    This works because:

    • binding usually completes within ~500–1500ms

    • retries allow hydration to finish

    ⚠️ Not elegant, but commonly used.

    ❌ What you cannot do

    There is no:

    • Quick View onLoad event

    • Quick View onChange event

    • reliable API callback for binding completion

    This is a known gap.

    Why this hasn’t been fixed

    Quick View Forms are:

    • legacy constructs

    • iframe-based

    • optimized for display, not scripting

    • intentionally limited to discourage business logic dependency

    Microsoft’s direction is:

    • read data directly

    • use Quick Views for UI only

    Which explains why this API edge case has never been fully resolved.

    Final answer (directly to your question)

    Is this expected behavior?

    Yes.
    Unfortunately, it is expected, even though the documentation strongly implies otherwise.

    Does isLoaded() guarantee attribute availability?

    No.
    It only guarantees the Quick View is rendered — not that its data is accessible via the client API.

    Best practice takeaway

    Never rely on Quick View Forms as a data source for logic.

    Use them for display only, and retrieve related data explicitly when needed.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 357 Most Valuable Professional

#2
Valantis Profile Picture

Valantis 326

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard