ArcherPoint Dynamics NAV Business Central Developer Digest - vol 339 Suzanne Scanlan Fri, 04/09/2021 - 05:45

ArcherPoint Dynamics NAV / Business Central Developer Digest - Vol 339

This edition of Developer Digest features a discussion of code changes in BC 16.11, protecting secrets in scripts, and preview environments for BC 2021 Wave 1.

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.

Managing Secrets in Your PowerShell Scripts

Did you know that publishing PowerShell packages includes all files in the folder? Including those that may have web service login information in them? Perhaps you forgot to mask this information. Don’t get caught with your files exposed…read Freddy’s tips on how to Manage Secrets in Your Scripts.

Confusion About a Code Change in BC16.11

Kyle asks: “Question of the day: I'm looking at the latest BC16.11 cumulative update, and in some pages, such as Customer Ledger Entries, they've changed this: 

     if GetFilters <> '' then
     if FindFirst then;

Into this:

     if (GetFilters() <> '') and not Find() then
     if FindFirst() then;

I do not understand. If I have filters, and the Find fails, why would a FindFirst succeed?”

Suresh replies: “The way I am reading it, Find might fail with those filters, but FindFirst will execute when there are no filters. It is an operation.

Kyle muses: “That's still weird. Just put if FindFirst() then; and be done with it.

Andrew adds: “Hi, with this code:

     if GetFilters <> '' then
     if FindFirst then;
     FindFirst might not be executed

With the new code:

     if (GetFilters() <> '') and not Find() then
     if FindFirst() then;
     FIND *always* gets executed—regardless of the filters.

The question is, why does Microsoft think that the FIND always needs to be explicitly executed?”

Shirley adds: "My guess is that this change would resolve an issue where you open the page, and instead of focus being on the record you were on the last time you ran that page, the FindFirst puts focus on the first record within the filters. So the new code will put focus on the record you were on last time IF that record is within the filters, otherwise it will do the FindFirst and put focus on the first record."

Kyle states: "Maybe I should ask the question a different way. 

if (boolean function call) and (boolean function call) 

Does the second boolean function call get executed if the first one evaluates to false?"

Andrew confirms: "Yes, both get executed."

Preview Environments for Business Central 2021 Wave 1

Several articles have been posted about the preview environment for the April release of Business Central. If you haven’t been there already, here’s what others have been experiencing with the preview:

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.