web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Verified answer
    ba365guy Profile Picture
    2,950 on at
    RE: autofill a lookup field based on a related table

    country field (schema name: ab_country) in opportunity and then dot

    System shows the allowed list of field from country's entity

    Region in opportunity and region in country entity should be same data type

    It should work

  • Community Member Profile Picture
    on at
    RE: autofill a lookup field based on a related table

    Yes i noticed this, but ab_region did not appear as an option after the dot and when I manually entered it was not accepted as a valid entry. Does the calculated field only work on field in the same entity?

  • ba365guy Profile Picture
    2,950 on at
    RE: autofill a lookup field based on a related table

    You manually type ab_country and then dot 

    System show the options via intelligence

  • Community Member Profile Picture
    on at
    RE: autofill a lookup field based on a related table

    Thanks ba365guy.

    Rebuilt the workflow to not run in background and now seems to be working (although took a while).

    I did actually try the calculated field but it didnt work - using the syntax above I wanted to enter 'ab_country.ab_region' in the box for however 'ab_region' was not an available option in the drop down which appeared (this field is on the custom entity for 'Country' not on the oppty. Any ideas?

    Much appreciated.

  • Suggested answer
    ba365guy Profile Picture
    2,950 on at
    RE: autofill a lookup field based on a related table

    Hi

    Run in background = No.

    The workflow should work in both the cases whether Region is a lookup or text. (i.e. in both opportunity and country entities "Region" should be text field)

    Once you save the record, just reload and check.

    Can you show your workflow snapshot here, like I gave the screens? 

    Alternatively, you can try a calculated field for instant result on form. (region in opportunity entity should be calculated field to implement below)

    The formula snapshot is below:

    Condition:

    pastedimage1577684931158v1.png

    Action:

    pastedimage1577684944751v2.png

  • Community Member Profile Picture
    on at
    RE: autofill a lookup field based on a related table

    Hi ba365guy, can I just clarify this comment.. I have follow the workflow steps in your solution but in my setup the Region field (simple, text field) should auto-fill based on update of Country (lookup).

    The 'Region' field is not a lookup. I have activated the workflow and can see in the 'Process Sessions' that the two records I updated the 'Country (Lookup) field that the status reason for these 'workflow jobs' = 'Succeeded'. However, I can't see this reflected on the forms where I have placed the Country (Lookup) and Region (text) field - is there usually a delay?

    Ordinarily, should I setup these workflows to NOT run in background?

    Many thanks ba365guy - appreciate your support on this.

  • Suggested answer
    ashish12 Profile Picture
    3,079 on at
    RE: autofill a lookup field based on a related table

    Hi,

    If your issue is resolved, please verify an answer and close the thread.

    Thanks,

    Ashish

  • LuHao Profile Picture
    40,888 on at
    RE: autofill a lookup field based on a related table

    Hi partner,

    If you have set the relationship between "Region" and "Country" in D365 (the lookup field of Country record is already filled with Region records), then the workflow is the most suitable way.

    Also, as mentioned in my previous answer, if the quick view form meets your needs, try to use the quick view form whenever possible.

    The field "Region" was created to show an attribute value of the "Country" record, however we can use the quick view form to directly display the attribute value of the "Country" record without creating any new fields.

    pastedimage1577161101169v1.png

    And we can directly add the relevant Region field value in the Opportunity view, so there is no need to create an additional Opportunity's field ‘Region’ to copy the Country's field value.

    pastedimage1577161274802v2.png

  • Community Member Profile Picture
    on at
    RE: autofill a lookup field based on a related table

    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?

  • ba365guy Profile Picture
    2,950 on at
    RE: autofill a lookup field based on a related table

    In the solution i provided, region is a lookup.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
DAnny3211 Profile Picture

DAnny3211 126

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 117

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans