Dynamics Business Central / NAV Developer Digest - Vol. 442

Dynamics Business Central / NAV Developer Digest - Vol. 442

ArcherPoint’s Developer Digest focuses on Microsoft Dynamics 365 Business Central and Dynamics NAV development. This week’s volume includes linking subforms with the Provider property, using the BindSubscription function, using regions, and debugging Upgrade and Install codeunits.

The Dynamics 365 Business Central community comprises professionals devoted to advancing the success of their customers. Developers, project managers, and consultants collaborate to share helpful information across blogs, forums, and social media sites. From discovering new solutions to finding answers to complex issues, these dedicated individuals are constantly sharing their knowledge with others. At ArcherPoint, we recognize and appreciate this highly engaged community’s creativity, hard work, and collective intelligence. To ensure all users can benefit from their expertise, we want to share their wealth of information with everyone.

Linking subforms with the Provider property

Tom Hunt asked, “I need to display a ListPart on the Sales Order page that shows the purchase order lines for the sales line selected on the Sales Order Subform. My challenge is that the two pages don’t see one another. Is there a way I could make this work?”

Arpan Bhagat replied, “Hi Tom! Check the Provider property of the page and add the Purchase Order Subform. Then link with Sales Order Subform. See the below screen for reference. You might need to set links based on Special Order or Drop Shipment as Purchase Lines store the SO Number in two different fields, Special Order Sales No. and Sales Order No. respectively.”

Tom Hunt responded, “Thank you, Arpan! This worked!”

Using the Provider property to link subforms
Using the Provider property to link subforms

Using the BindSubscription function

Yann Saint-Laurent posted, “I had never heard of the BindSubscription function until this morning when Matt T. demonstrated it. I did some reading, and it looks very useful. I wanted to share it with everyone in case it flew under your radar, too! There are a few blogs about it, but this one from Ricardo Moinhos explains it very well with three use cases: Bind Subscription in Dynamics NAV / Business Central.

Pranav Joshi replied, “BindSubscription is an awesome feature! I use it a lot, especially when we have to call events from the test script.”

Christine Henderson added, “We use this in some of the automated tests, particularly when using TestPages to simulate a user taking some actions on a page. The EventSubscriberInstance property of the codeunit is set to Manual. In each test procedure, it uses BindSubscription(SomeTestCodeunit). Then, when using the TestPage methods, the events on the page will run.

Using regions to make code more readable

Pranav Joshi posted, “You can use #region and #endregion in your AL to make code more readable and divide it into the segments. Another nice thing about regions is that you can expand and collapse them! Regions are available in BC 2020 Wave 2 and later.”

Using #regions in AL
Using #region and #endregion AL to make code more readable and divide it into segments

Debugging Upgrade and Install codeunits

Yann Saint-Laurent posted, “Ever wonder how you could debug upgrade and install codeunits? This blog post from YUN ZHU explains how very well: Dynamics 365 Business Central: Debugging Upgrade and Install code in Visual Studio Code.”

Christine Henderson replied, “I use this all the time. As we add new functionality, we often need to load new data from the Data Load codeunit. This also means modifying the Upgrade codeunit to load the new data when existing installations are upgraded to a newer version that we have released to App Source. This lets you run it multiple times during development, if necessary, to check that it works as expected.”

Congratulations MVPs!

Shout out to all that have just received notification of their inclusion in this year’s class of Microsoft MVPs! We couldn’t do Dev Digest without you. Congrats and thank you for your contributions to this community!

Interested in Dynamics NAV and Business Central development? Be sure to see our collection of NAV/BC Development Blogs.

Read “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
Last Name
Subscription Options
Your Privacy is Guaranteed