In this blogpost, we will learn to use the ‘isLoaded’ client reference API to check if the Quick View form is loaded in Power Apps / Dynamics 365 CE. Before we begin, ensure you subscribe to CRM Crate to remain informed about the latest developments in the Power Platform field.
In Dynamics 365 Customer Engagement (CE) / Model-Driven Apps, a Quick View Form is a type of form that provides a streamlined way to display key information from related records. Unlike main forms, which present detailed data and offer a variety of functions, Quick View Forms are designed for efficiency and simplicity. They are often used to show important details from a related entity without navigating away from the current record. For instance, if you’re viewing an account record, a Quick View Form might display essential contact details directly within the account form. This helps users access relevant information quickly, improving the overall efficiency of data management and interaction within the application.
Ensure that the Quick View form is fully loaded before retrieving its attributes
Sometimes, when the main form is loading, the quick view control might not have finished loading completely. This means that if you try to get data from it or use methods related to data, it might not work properly. To check if the quick view control is fully loaded and its data is ready, you can use the ‘isLoaded’ client reference API.
quickViewControl.isLoaded();
Indicates whether the data binding for the controls within a quick view control is fully completed.
Here’s an example of how to use the isLoaded
method to check if the data binding is complete, and then get the value of the column that a control in the quick view is connected to.
var validateQuickViewControl = function (executionContext) {
var formContext = executionContext.getFormContext();
try {
var quickViewControl = formContext.ui.quickForms.get("<QuickViewSchemaName>");
if (quickViewControl != undefined) {
//Validate Quick View Control
if (quickViewControl.isLoaded()) {
var attributeValue = quickViewControl.getControl().find(control => control.getName() == "<AttributeSchemaName>").getAttribute().getValue();
//Display Popup Notification On Success
var alertStrings = { confirmButtonLabel: "Okay", text: "Quick View Control is loaded completely with sample attribute value - " + attributeValue, title: "Quick View Control" };
var alertOptions = { height: 120, width: 260 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
function (success) {
console.log("Alert dialog closed");
},
function (error) {
console.log(error.message);
}
);
}
}
}
catch (e) {
JSON.stringify(e);
console.log("Tracing - An error occured with detail - " + e.message + ".");
}
};
In conclusion, using the isLoaded
API is essential for ensuring that a Quick View form in Power Apps is fully loaded before attempting to access its data. This method helps you confirm that all data bindings are complete, which prevents errors and ensures that you can reliably interact with the form’s controls and their associated data.