Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
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 | Upcoming TechTalks
Well well well! They finally added this! In a way
As all of you are aware one beautiful thing that a lot of programming languages have is the “Try-Catch” statement. C/AL didn’t have this though. And some people never thought it would.
If you are curious about this and you want to go into more detail I invite you to check Vjeko’s blog entry for more information.
As it happens, Microsoft thought this would be a neat thing to have, and they added a property when defining the functions as follows:
Yey! Finally! Let me copy-paste a small text from the help regarding this property:
– Try function calls do not require that write transactions are committed to the database.
– Changes to the database that are made with a try function are not rolled back.
So what it basically says is that it is very similar to what we were able to do using codeunits.
One of the biggest advantages to me is not having to use one new codeunit everytime we need to “trycatch” a process. This can end up consuming a lot of codeunits in some cases.
I tried a very simple and quick example just to see it working. To do so I created a new codeunit and added a new function named “MyTryFunction” and set the “TryFunction” property to true. Here you go!
And if you guessed that it would end up giving me a message saying “NOT OK”, you have guessed right
I’m going to start thinking how I’m going to redesign some of my developments with this
The post How To: Try-Catch in C/AL for NAV2016 appeared first on Code4NAV.com.
Business Applications communities