Skip to main content

Notifications

Community site session details

Community site session details

Session Id : IxAqOcKqktXKEbjpBVAotm
Power Apps - Microsoft Dataverse
Unanswered

Update form Field from lookup field within quickview

Like (0) ShareShare
ReportReport
Posted on 27 Jun 2023 15:37:01 by 10

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;
 }
}

 

 

 

Categories:
  • Drew Poggemann Profile Picture
    9,278 Most Valuable Professional on 29 Jun 2023 at 11:48:47
    Re: Update form Field from lookup field within quickview

    Hi @ConnollyZ ,

    Hopefully someone can help you with the JS but another thought is to create a new text field on your table that is a calculated field and set the value to something like the following format.  My example is actually a Retreat with a 1:N relationship to Registrations.  On the Registration table I have the lookup to the Retreat so can set a calculated column like this:

    dpoggemann_0-1688039228059.png

    This will automatically populate that field on all records related to the parent text field.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Microsoft Dataverse

#1
stampcoin Profile Picture

stampcoin 17

#2
mmbr1606 Profile Picture

mmbr1606 13 Super User 2025 Season 1

#3
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

Overall leaderboard

Featured topics

Loading started