Get Access and field Value from QuickView Form


Get Field Value and control from Quick View Form in MSCRM using JavaScripts.

To access the control or attribute in MSCRM form. The script you will use to control or attribute name.. Quick View Form has different way of accessing its field.
If I have Quick form for custom entity “Configuration”, and I added this quick form in “new_application” entity form.
To access new_application quick form in car entity form I need to use Quick form name, entity name and attribute name to get value.

To access in JavaScript Quick view, control name should be like
QuickFormname_QuickFormname_EntityName_AttributeName

For UCI Forms:  Just take the form context and the XRM inbuilt statement to get the QuickView Form, use the quickfiewform name to get the object.




My Quick Form name is : ConfigQuickView
Entity Name : new_application
Attribute: new_applicationname

 

function getAttributeValue(executionContext) {
if (!Xrm.Internal.isUci()) //If legacy Forms
{
    if (Xrm.Page.getControl('ConfigQuickView_ConfigQuickView_new_application_new_applicationname') != null) {
        var configApplication = Xrm.Page.getControl('ConfigQuickView_ConfigQuickView_new_application_new_applicationname'); var appName = configApplication.getAttribute().getValue();
    }
}
else {
    var formContext = executionContext.getFormContext();
    var quickViewControl = formContext.ui.quickForms.get("ConfigQuickView");
    if (quickViewControl != undefined) {
        if (quickViewControl.isLoaded()) {
            //add your code or process
        }
    }
    else {
        setTimeout(getAttributeValue, 10, executionContext);
    }
}
}