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 and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
Starting from Dynamics NAV 2013, dimensions structure has changed a lot. Since then, a lot of developers struggle to insert or update dimensions pragmatically.
I will not bother you with what was already explained a hundred times in other blogs on how to calculate Dimension Set ID. Better, I will share with you a simple codeunit “SpecDimensionManagement” that will save you time whenever you will need to update dimensions (by update I mean Create, Update, Delete).
In order to use my codeunit, I invite you respect the following example:
WITH SpecDimensionManagement DO BEGIN
// Get Current Dimension Set ID or init a new one
// Update my dimensions values
// Calculate my new Dimension Set ID
MyRecord."Dimension Set ID" := GetDimSetID;
// Get new values if needed
GetCurrDimValues(DimCode, DimValueCode, MyRecord."Dimension Set ID");
I put some comments to explain what the functions do.
In the fob, you’ll find codeunit 92600 that handle the calculation and codeunit 92601 where I create some examples for test.
Feel free to contact me if you need more details / informations. Share your ideas and feedback in comment section
P.S: the fob is from a NAV 2015 FR (Build 49000) database. I test it on NAV 2017 and 2016 also.
This blog is available also on Microsoft Dynamics NAV Community
Business Applications communities