Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

How to populate lookup field in C# ?

Posted on by Microsoft Employee

there are 3 entities - Contact, City, Country

city and country has a relation many to 1 (each city related to only one country)

contact has lookup fields for city and country

my mission is to create a new contact filling up fields firstname,lastname and city in C#.

the country lookup field is supposed to be populated based on what city lookup is set.

i've already generated through crmsvcutil.exe a file that has all the entities but im not sure how to use it to get/set lookup values.

my problem is that i didnt understand how to populate the city and country lookup fields

how to set an existing lookup value to the field in contact ?

also how can i refer to the country thats related to the given City so i would know which country lookup to fill ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to populate lookup field in C# ?

    Hi Partner,

    You can refer following link:

    Populate a Lookup field on Account creation using a Plugin - Microsoft Dynamics CRM Forum Community Forum (dynamics-int.com)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans