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.
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:
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
For instance, I’ve added a Quick View Form of related entity "User"
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; } }
I created a new record ( of this Entity)
I opened this record and debug the code using F12:
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.
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.
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()
Hi Wahaj, Its a single line of text. I suppose this might be a bug
Hi,
What is the type of field at index 0?
Best,
Wahaj
Siv Sagar
149
Super User 2025 Season 1
Muhammad Shahzad Sh...
61
Most Valuable Professional
Daivat Vartak (v-9d...
53
Super User 2025 Season 1