Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Accessing Quick View Controls

(0) ShareShare
ReportReport
Posted on by 40

Hi everyone, 

I am trying to access a quick view control using the JavaScript Web API and was able to access it however accessing the field values gives me an error message returning a value of null. I have also used the isLoaded method as suggested to verify that the control has been loaded completely on the form but still no luck for me.

As specified in isLoaded, a control's value can be accessed through this way: 

var myValue = quickViewControl.getControl("schema_name").getAttribute().getValue();

The code isn't working as expected as it returns null, I tried using the console using Xrm.Page and I was able to access the field value using the following code:

var myValue= quickViewControl.getControl("schema_name").getValue();

It works but the weird thing is it doesn't work on the first control (index 0) of the controls collection as the value returns null also. I was able to verify that the field really contains data.

I don't know if this can be considered as a bug right now as there seems to be no other way to access these field values on the quick create form.

  • Verified answer
    Roberto Ilidio Profile Picture
    on at
    RE: Accessing Quick View Controls

    Hi Ace, 

    It is working fine in my test environment. Let me share my sample and maybe it can help you to adapt to your scenario:

    • Step 1)  I've added a Quick View Control to the Form:

     

    Settings -> Customizations -> Customize the system -> Open any existing  Entity ( or create a new one ) -> Open any Form ( or create a new one) -> insert Quick View Form

     QuickViewForm.png

    For instance, I’ve added a Quick View Form of related entity "User"

    QuickVIewFormProperties.png

    • Step 2)  I’ve added to this Form,  a Jscript web resource, coping the sample code available in Microsoft documentation.  Also added the line of code previous mentioned ( to search for a specific attribute)

      My code:

    function getAttributeValue(executionContext) {
    
        var formContext = executionContext.getFormContext();
        var quickViewControl = formContext.ui.quickForms.get("MyQuickViewForm");
        if (quickViewControl != undefined) {
            if (quickViewControl.isLoaded()) {
    
    			// Access the value of the first attribute bound to the constituent control
    			var myValue = quickViewControl.getControl(0).getAttribute().getValue();
    		
    			// search by a specific Attribute Name          
    			var myAttributeNameValue=  quickViewControl.getControl().find(control => control.getName() == "internalemailaddress").getAttribute().getValue();
    
    			console.log(myValue);
                return;
            }
            else {
                // Wait for some time and check again
                setTimeout(getAttributeValue, 10, executionContext);
            }
        }
        else {
            console.log("No data to display in the quick view control.");
            return;
        }
    }

    • Step 3)  Verified the scenario:

    I created a new record ( of this Entity)

    I opened this record and debug the code using F12:

    debug

    Form

    Code is working fine in both, UCI and classic Web. I was able to retrieve the Attribute successfully.

    Please, let me know if you can adjust your scenario based on this sample.

  • acejavier Profile Picture
    40 on at
    RE: Accessing Quick View Controls

    Hi Roberto,

    I have tried the code snippet that you have suggested but it doesn't work either, seems like it behaves the same as the previous one.
    As you can see on the screenshot below using the getAttribute().getValue() returns a null and an error was thrown.
    I have tried using the getValue() directly and also gave me a null value - this field is the first index in the control collections.
    Using the getValue() directly on the other fields returns the field's value as oppose to the getAttribute().getValue() method.

    pastedimage1595579428795v1.png

  • Verified answer
    Roberto Ilidio Profile Picture
    on at
    RE: Accessing Quick View Controls

    Hi Ace,

     This sample code is ok

    var myValue = quickViewControl.getControl(0).getAttribute().getValue();

     

    It returns the first Attribute of the Quick View Form. If it is returning "null" is because the first Attribute of a given record is null.

    Alternatively, instead of get a specific position of the array, if for instance, we need to specifically search by an AttributeName, we can do a find on the array as below:

    var myAttributeFullNameValue =  quickViewControl.getControl().find(control => control.getName() == "fullname").getAttribute().getValue()

  • acejavier Profile Picture
    40 on at
    RE: Accessing Quick View Controls

    Hi Wahaj, Its a single line of text. I suppose this might be a bug

  • Wahaj Rashid Profile Picture
    11,321 on at
    RE: Accessing Quick View Controls

    Hi,

    What is the type of field at index 0?

    Best,

    Wahaj

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 149 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 61 Most Valuable Professional

#3
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 53 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans