Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested answer

Lookup field displaying the wrong lookup field

(0) ShareShare
ReportReport
Posted on by 10
Hi everyone!

I'm experiencing a challenge with a Quick View Form on the Case entity in my D365 CE solution. The form setup is as follows:

Case Form Configuration:

There's a Quick View Form integrated into the Case form, named 'Quick View Form for Case'. This quick view form is supposed to show Opportunity information.
This Quick View Form includes two lookup fields: 'Business Unit' and 'Activity Line'.
 
Opportunity Lookup Field:

Additionally, the Case form features an 'Opportunity' lookup field.
When an Opportunity is selected in this field, the 'Quick View Form for Case' becomes visible on the Case form.
 
Purpose and Issue:

The purpose of this Quick View Form is to display related information from the selected Opportunity, including details like the Activity Line.
However, I'm encountering an issue where the 'Activity Line' field in the Quick View Form does not display the correct information from the related Opportunity.
Activity Line is a lookup field that looks to the 'BU' table. The problem is that this lookup field show's the 'Name' of the BU but it's actually supposed to show another value, it's supposed to show the 'Cluster' of the BU. Cluster is another lookup field on the BU form, so is name obviously. 
 
Any ideas on how to implement this?
 




 
  • Dengliang Li Profile Picture
    Microsoft Employee on at
    Lookup field displaying the wrong lookup field
    Hi,
     
    Has the issue been solved?
    Have there been any updates? Please feel free to ask me if you have any questions!
    If it has been resolved, can you mark the response as an answer?
     
  • Suggested answer
    Dengliang Li Profile Picture
    Microsoft Employee on at
    Lookup field displaying the wrong lookup field
    Hi,
     
    There is no OOB functionality available for your requirement, it needs to be implemented through custom business logic.
    This can be implemented via JavaScript for this requirement.
     
    function onload(executionContext) {
        var formContext = executionContext.getFormContext();
     
        //get the quick View Form Control on the case form
        var qucikViewControl = formContext.ui.quickForms.get("<QuickViewControlName>");
     
        if (qucikViewControl != undefined) {
            if (qucikViewControl.isLoaded()) {
     
                //Get the Owning Business Unit field on the Quick view form.
                var businessUnit = qucikViewControl.getControl("owningbusinessunit").getAttribute();
                //get the Owning Business Unit field value id
                var buId = businessUnit.getValue()[0].id;
     
                // Get the related business unit record by buId.
                Xrm.WebApi.retrieveRecord("businessunit", buId).then(
                    function success(result) {
     
                        //Determine if the value of the lookup field you want is empty, here I am using the Created On lookup field.
                        if(result.createdon !==null){
                            var lookup = new Array();
                            var lookupvalue = new Object();
                            lookupvalue.id = buId;
     
                            //Replaces the field display name of Owning Business Unit with the value of the Created On field.
                            lookupvalue.name = result.createdon;
                           
                            lookupvalue.entityType = "businessunit";
                            lookup[0] = lookupvalue;
                            businessUnit.setValue(lookup);
                        }else{
                            console.log("the createdon field value is null!")
                        }
                       
                    },
                    function (error) {
                        console.log(error.message);
                        // handle error conditions
                    }
                );
     
                return;
            }
            else {
                // Wait for some time and check again
                setTimeout(onload, 10, executionContext);
            }
        }
        else {
            console.log("No data to display in the quick view control.");
            return;
        }
     
    }
     
     
     
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,272 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,927 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans