ArcherPoint Dynamics NAV Business Central Developer Digest - vol 330

ArcherPoint Dynamics NAV Business Central Developer Digest - vol 330

 

This edition of Developer Digest highlights the Database Locks feature and the instant “With” statement in Microsoft Dynamics Business Central.

The Dynamics NAV and Business Central community, including the ArcherPoint technical staff, is made up of developers, project managers, and consultants who are constantly communicating, with the common goal of  sharing helpful information with one another to help customers be more successful.

As they run into issues and questions, find the answers, and make new discoveries, they post them on blogs, forums, social media…so everyone can benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this community—so we thought, wouldn’t it be great to share this great information with everyone who might not have the time to check out the multitude of resources out there? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from NAV/BC experts and devotees around the world. We hope these insights will benefit you, too.

Developer Tip of the Day: Database Locks

Kyle shares a Developer Tip of the Day about database locks. “As of BC16, there is a new Page included in the Base app called Database Locks. 

Another interesting bit: there is this little snip of code in OnOpenPage. I have not used the notification variable type before.”

     trigger OnOpenPage() 
     var 
     Notification: Notification; 
     begin 
     Notification.Message := DatabaseLocksPageMsg; 
     Notification.Send(); 
     end; 
     var 

DatabaseLocksPageMsg: Label ‘This page shows a snapshot of all database locks. Where possible, it displays details on the AL session that is causing the SQL lock.’

Instant “With” Statement Corrections

Len B is excited to share this: “OK, I am so excited about this one! In my pursuit to keep up with customer requests along with keeping RPM working on all new versions of BC (and builds and testing, you know), I was desperate to find a way to deal with the new requirement of implicit/explicit With statements in the hundreds of objects in RPM. 

Originally, I found that the AL compiler actually has a way of handling explicit With statements, but it is one by one, and turning on that feature bogs down your computer. So, I had to find something else.

I found online that the AL CodeActions had one, so I went to check it out, but it is not there. I looked in the changelog for that extension and found that they removed it because the AZ AL Dev Tools/AL Code Outline had one. I went to go check that out, and WOW! 

AMAZING! Personally, I never see these because they are only available through Ctrl+Shift+P, command palette. They have two options: Remove ‘with’ Usage from Active Editor and Remove ‘with’ Usage from Active Project. Well, I chose the “Active Project” option, and in less than 5 minutes, I had 400 objects in my pending changes! It did explicit AND implicit with statements! All my pages, reports, tables, codeunits…changed instantly. 

So, there you have it; you NEED this extension. The greatest thing is that you can run it when you finish an object to be sure you remembered all the implicit with statements we normally take for granted! 🙂 

     Name: AZ AL Dev Tools/AL Code Outline 
     Id: andrzejzwierzchowski.al-code-outline 
     Description: AZ AL Development Tools: AL code outline, object browser, object creators 
     Version: 2.0.22 
     Publisher: Andrzej Zwierzchowski 

Find it here: AZ AL Dev Tools/AL Code Outline for Visual Studio Code 

Matt T adds: “Just to add to this, as I used it successfully on a project with 500+ objects, I advise running this and checking the changes in by themselves. You don’t want to have ‘real’ changes intermingled in there, or you’ll never be able to track them down. 

Also, don’t forget to have your Cops/Settings enabled. You’ll get warnings about the implicit Withs, so you know to fix them immediately as well.”

If you are interested in Dynamics NAV and Business Central development, be sure to see our collection of NAV/BC Development Blogs.

Read the “How To” blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV and Dynamics 365 Business Central.

Trending Posts

Stay Informed

Choose Your Preferences
First Name
*required
Last Name
*required
Email
*required
Subscription Options
Your Privacy is Guaranteed