Breaking news from around the world
Get the Bing + MSN extension
Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
Say you have a table that contains a set of fields in a base model. Then, in another model, you add some new fields as extensions to the table metadata. It seems like a legitimate ask to be able to access the extension fields as easily from C# as you can in X++. As it happens, the story for accessing the extended fields from C# is a little more convoluted; in the future, we may consider adding C# extension methods to fix the problem, but for now you will need to use the setFieldValue and getFieldValue methods on the Common class (from which all tables are derived):
MyTable t; t.setFieldValue("MyExtensionField", expr);
where "MyExtensionField" is the name of the extension field and expr is the value you want to assign to it. There are similar getFieldValue methods on Common, with one overload accepting an integer describing an array index.
You might consider adding your own extension method to hide the gory details. It is unfortunate that you cannot do extension properties in C# yet, which would have been a good solution.
Business Applications communities