web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Show data in lookup field from separate entity other than primary key

(0) ShareShare
ReportReport
Posted on by

What I am looking to do is show more data in the lookup field on the Contact form. I have a separate entity for location that I created  which has three fields: City, Province and Country.  Right now the lookup field on the Contact form only shows the city (PK) but I would like it to show the City, Province, Country from the location entity. I understand I need to use Javascript to do this I am just not sure about the code and how to get the data from the location entity to the contact form other than the city.

Any help would be greatly appreciated.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Flydancer Profile Picture
    1,332 on at

    Which CRM Version are you using? If it's an actual one you can add a quick view form to achieve your goal. See www.magnetismsolutions.com/.../how-to-add-a-quick-view-form-in-microsoft-dynamics-365

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi TJE ,

    If I am not wrong you want to display more data in the city lookup itself. If yes then you need to just change the lookup view of location entity.

    Go to settings -> customization > customize the system/ solution -> Expand entity - > Expand location entity > views > open the lookup view > add columns Province , country .

    For more information see below references-

    [View:https://arunpotti.wordpress.com/2017/05/31/how-to-customize-lookup-views-in-crm/]

    [View:https://ledgeviewpartners.com/blog/customize-lookup-views-in-dynamics-crm/]

    Changing above you will see those data when you going to search city lookup but not in the selected lookup value.

    If you wish to display province and country field after selected the city lookup you need to go for quick view form,  You don't need to write any JavaScript. Just create a quick view form in the location entity and add the the quick view form in the contact entity.

    [View:http://www.websan.com/blog/item/720-create-d365-quick-view-forms-in-3-easy-steps]

  • Community Member Profile Picture
    on at

    Thanks for the help as I may use this in the future but this isn't exactly what I need for this. I have a list of locations saved in the Location entity, I would like to use a lookup in the contact form to lookup a saved location and display the city, province and country all in the lookup box rather that have a separate box displaying the information. Currently the location lookup box will only display the city (i.e. Winnipeg) as it is the primary key but I would like it to display Winnipeg, Manitoba, Canada (which is what the location is saved as in the location entity).

    Hope that is more clear.

  • Community Member Profile Picture
    on at

    Hi Goutam,

    Thanks for the suggestions. I do have that working - showing the full location once you click on the search icon in the lookup box (the actual lookup view has city, province, country). My problem is I want the box  to display the whole location without having to click the search icon.

    locpic.png

    Here is what it looks like now, I would like it to display "Winnipeg, Manitoba, Canada" instead of just "Winnipeg"

    Thanks again for the help.

  • Community Member Profile Picture
    on at

    Here are two other solution I looked at but they only show you how to change the field name for the Id. I would like to display more information in the field.

    burnignorance.com/.../how-to-change-display-text-of-a-lookup-field-in-dynamics-crm-2011-using-javascript

    community.dynamics.com/.../136580

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi TJE,

    You can not set multiple columns  in the lookup selected value.

    When you select Lookup field value  it's basically set   name and I'd field by default for every lookup to show the selected value and you can't change this behaviour untill and unless you fill the city name value with province and country.

    So there is only one chances that when you create the location record fill the primary key name with  name +Country+ Province  in the onchange event of country and province at the time of creating location.

    In simple words you need to save the name value by concatenating province and country text in location entity.

  • Verified answer
    Community Member Profile Picture
    on at

    Okay so what I ended up doing was I created 3 separate fields in the location entity: city, province, country to go along with the name (pk) field. I than created a process(workflow) that would set the name field to what was entered in the city, province and country field when it is saved. I then made the name field not visible on the form as it will be filled by the rest of the data.

    Now when searching for a location from the contact entity the city, province and country are displayed.

    Thanks for the help everyone.

  • gdas Profile Picture
    50,091 Moderator on at

    Hi TJE,

    Please close the thread by verifying answers.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans