Make sure you are using Name of Quick view form instead of label, as name cannot have space like you used.
Also, you may need to use isLoaded
method to ensure the complete rendering and setTimeout
for retry. Read more
function getAttributeValue(executionContext) {
var formContext = executionContext.getFormContext();
var quickViewControl = formContext.ui.quickForms.get("<QuickViewControlName>");
if (quickViewControl != undefined) {
if (quickViewControl.isLoaded()) {
// Access the value of the attribute bound to the constituent control
var myValue = quickViewControl.getControl(0).getAttribute().getValue();
console.log(myValue);
// Search by a specific attribute present in the control
var myValue2 = quickViewControl.getControl().find(control => control.getName() == "<AttributeSchemaName>").getAttribute().getValue();
console.log(myValue2);
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;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…