Hi,
On my main form I have a lookup field called "Name", when the user selects "Name" a quickview is displayed, one of the fields within the quickview is a lookup field called "Course_Information". I am trying to take "Course_Information" and write that value into a field on the main form called "courseinformation".
Nothing happens the first time I select a "Name" from the lookup field. When I remove the item "Name" and select the "Name" a second time, the below code then copies the quickview field into the form field.. Im unsure why this is happening. Any support would be appreciated
function OnLoad1(executionContext) {
Xrm.Page.getAttribute("nelep_studentapplication").addOnChange(getQuickViewForm);
}
function getQuickViewForm(executionContext)
{
var formContext = executionContext.getFormContext();
var quickViewControl = formContext.ui.quickForms.get("QuickviewControl1682435827537");
if (quickViewControl != undefined) {
if (quickViewControl.isLoaded()) {
// Access the value of the attribute bound to the constituent control
var CourseInformation = quickViewControl.getControl(0).getAttribute().getValue();
var CourseID = CourseInformation[0].id;
var CourseName = CourseInformation[0].name;
var CourseType = CourseInformation[0].entityType;
formContext.getAttribute("courseinformation").setValue([{ id: CourseID, name: CourseName, entityType: CourseType }]); // Unit Group
return;
}
else {setTimeout(getQuickViewForm, 1, executionContext);
}
}
else {
Xrm.Utility.alertDialog("No data to display in the quick view control.");
return;
}
}