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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Javascript Accessing Field from QuickViewForm

(0) ShareShare
ReportReport
Posted on by 50

Hi All,

I'm trying to access a Quick View Form Field via Javascript.

I've checked that the form is loaded and i can get access to the object but i'm unable to access the field value

var formContext = executionContext.getFormContext();
var qvc = formContext.ui.quickForms.get("maintenantinfo");

if (qvc.isLoaded())
{

var birthday = null;
var x = qvc.getControl("birthdate")
birthday = qvc.getAttribute().getValue();

}

Then an error is thrown

Cannot read property 'getValue' of null

I've tried accessing the field directly to no success as well.

any help would be greatly appreciated

  • Suggested answer
    LeoAlt Profile Picture
    16,341 Moderator on at

    Hi partner,

    You used the wrong varibale.

    You should use "x" to getAttribute, not "qvc", "qvc" is quick view form control, not the field.

    pastedimage1590714737238v1.png

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/getattribute.

    For example, I want to get the contact email from contact quick view form in account form, I will use the following code.

    pastedimage1590714945404v3.png

    //get field value from quick view form
    function getField(executionContext){
        formContext=executionContext.getFormContext();
        var qvc=formContext.ui.quickForms.get("contactquickform");
        if(qvc.isLoaded()){
            var email=null;
            var x=qvc.getControl("emailaddress1");
            email=x.getAttribute().getValue();
        }
        alert(email);
    }

    Best Regards,

    Leo

  • DarrenMog Profile Picture
    50 on at

    Thank Leo for reply.

    I did a copy an paste error on the form.

    My code is

    var formContext = executionContext.getFormContext();
    var qvc = formContext.ui.quickForms.get("maintenantinfo");
    if (qvc != undefined)
    {
    if (qvc.isLoaded())
    {
    debugger;

    var birthday = null;
    var x = qvc.getControl("birthdate")
    birthday = x.getAttribute().getValue();

    }

    }

    I can hit the object birthdate but when i try and get Value on X it throw the error

    Cannot read property 'getValue' of null

    Cheers

  • Suggested answer
    LeoAlt Profile Picture
    16,341 Moderator on at

    Hi partner,

    Looks like "birthdate" is a custom field, so you need to use the complete name with its prefix. In default, the prefix of custom field is "new_".

    pastedimage1590735956362v1.png

    Regards,

    Leo

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

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Travis South Profile Picture

Travis South 54

#2
11manish Profile Picture

11manish 37 Super User 2026 Season 2

#3
ParthPatel249 Profile Picture

ParthPatel249 33

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans