Skip to main content

Notifications

Community site session details

Community site session details

Session Id : LNZtSnsjOZ3wRGgGKtFquj
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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard

Featured topics

Loading started