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 :
Customer experience | Sales, Customer Insights,...
Answered

autofill a lookup field based on a related table

(0) ShareShare
ReportReport
Posted on by

Hi,

I want users of a Oppty form to complete a lookup field ("Country") then have another field "Region" autofill to save them time, based on a value in a field (also called "region") on a custom table "Country" which has a list of countries. In this table I have effectively 'mapped' each country to a region e.g. EMEA, APAC etc, and I want the mapepd value to appear in the Oppty form.

What is the best way to go about doing this, so that the user when they put a value agains the lookup field for Country, it autofils 'region' (based on my mapping).

Thanks all,

Andrew

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

    If that field Oppty.Region already exists I would suggest a Workflow triggering on create and change of field Country. If it doesn't exist I would suggest a Calculated Field where you simply display the Region of the Country.

  • Suggested answer
    moko33 Profile Picture
    1,788 on at

    If that field Oppty.Region already exists I would suggest a Workflow triggering on create and change of field Country. If it doesn't exist I would suggest a Calculated Field where you simply display the Region of the Country.

  • Community Member Profile Picture
    on at

    Hi moko33,

    Thanks for the reply!

    The Oppty.Region field doesnt exist (but can easily be created) but Im interested in your second option - how can you create a calculated field with the region of the country? What might that formula look like?

  • Community Member Profile Picture
    on at

    Sorry moko33, I'm something of a novice - would you mind also stepping me through the workflow logic (your first recommendation) as well in a bit of detail? Also, just to be clear, the Country field is a lookup to a custom table.

  • Suggested answer
    ba365guy Profile Picture
    2,950 on at

    Hi

    I have a similar situation going on. Please see the below solution:

    1. Create a workflow on Opportunity entity.

    2. Trigger for workflow on change of "Country" (lookup)

    3. Workflow snapshot

    pastedimage1577155672153v1.png

    4. Update region:

    pastedimage1577155695696v2.png

    5. Save and Publish

    6. Make sure the users have appropriate privileges for country and region entities

    Let me know if this works for you.

  • LuHao Profile Picture
    40,892 on at

    Hi partner,

    So there is a lookup field "Country" and a text field "region" on the Opportunity form, you would like to populate the field "region" based on the value of the selected field "Country", right?

    If so, I would recommend you use calculated field to achieve it.

    Here is a demo.

    I have 6 countries records.

    pastedimage1577156599968v4.png

    There is a lookup field "Country" and a text calculated field "region" on the Opportunity form. 

    pastedimage1577156353801v1.png    pastedimage1577156428079v2.png    pastedimage1577156455583v3.png

    The logic of the calculated field is shown below.

    (Note that the text in the action of the calculated field requires double quotes.)

    pastedimage1577156623628v5.png    pastedimage1577156706011v6.png

    The effect is that when I select a country and save the Opportunity record, the field "region" will be automatically filled with the corresponding value.

    pastedimage1577156774210v7.png

  • LuHao Profile Picture
    40,892 on at

    Hi partner,

    If "region" is also a lookup field and the entity region and country have a 1: N relationship, then you have to use a workflow.

    In addition, if the field "region" is only used to display the selected country's attribute, it does not require user input value, then from a certain point of view, it is actually a redundant field.

    Instead of creating a field "region" for the Opportunity entity, we can use the quick view form to display the value of the field "region" for the country which is selected on the Opportunity form.

    The quick view form can display the field values of related records without creating any additional fields within this entity.

    In this way, you can reduce the storage occupied by the new field and avoid the need to set up calculated fields or workflows.

    Quick view form introduction: https://carldesouza.com/dynamics-crm-quick-view-forms/

  • Community Member Profile Picture
    on at

    That's much appreciated - If the Region field was a lookup, would this solution change?

  • ba365guy Profile Picture
    2,950 on at

    In the solution i provided, region is a lookup.

  • Community Member Profile Picture
    on at

    Thanks Lu Hao. I should have mentioned the custom table (i.e the country list) contains around 80 values so i sense this would be a good soln for a smaller list. Knowing this, does that perhaps put the workflow solution as preferred?

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans