Dynamics Business Central / NAV Developer Digest - Vol. 496

Dynamics Business Central / NAV Developer Digest - Vol. 496

ArcherPoint’s Developer Digest focuses on Microsoft Dynamics 365 Business Central and Dynamics NAV development. This week’s volume includes using PowerShell to prompt for a file location, new AI tools for programmers, a resource for working with legacy code, comparing local and internal procedures, and a useful Business Central information resource.

The Dynamics 365 Business Central community, consisting of developers, project managers, and consultants, collaborates across various platforms to share valuable insights. At ArcherPoint, we greatly value their dedication and expertise. To ensure widespread access to this technical knowledge, we created Developer Digest.

Using PowerShell to prompt for a file location

PowerShell “Prompt” Question:

How can I change this to prompt the user for a location to the license file instead of hard coded like in this example.

$licenseFile = ‘C:\temp\TEMP-BC.bclicense’

Similar to how I got this to prompt for a user/pw

$credential = Get-Credential -Message ‘Using UserPassword authentication. Please enter credentials for the container.’

Answer:

Add-Type -AssemblyName System.Windows.Forms

$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog

$OpenFileDialog.InitialDirectory = [Environment]::GetFolderPath(‘MyDocuments’)

$OpenFileDialog.Filter = “All files (*.*)|*.*”

$OpenFileDialog.Multiselect = $false

$result = $OpenFileDialog.ShowDialog()

if ($result -eq [System.Windows.Forms.DialogResult]::OK) {

$filePath = $OpenFileDialog.FileName

Write-Output “Selected file: $filePath”

} else {

Write-Output “No file selected.”

}

++++++++++++++++++++

New AI tools for programmers

Yann Saint-Laurent posted:

Some new AI powered tools have just popped up on the scene that are just amazing, enabling you to program without coding.

 Aider.chat and Claude-Dev are certainly at the top of that list.

Working with legacy code?

Jon Long posted:

I’m reading Michael Feathers’s book Working Effectively with Legacy Code. I love it. It is highly recommended for anyone who has to deal with “legacy code.” And who doesn’t?

According to the author, “legacy code” doesn’t mean what we often think it does—a mangled, rotten mass of old, unreadable code that wasn’t written by you. He suggests it’s code that was written without tests, the tests you write with a developer’s test framework.

Comparing local and internal procedures

Question: What is the difference between a local procedure and an internal procedure?

Tom Hunt replied: A local procedure can only be called from within the object. An internal procedure can be called from any object in its app, but not by objects outside of its app.

Useful Business Central information resource

Elyes Ferchichi posted:

CentralQ is a sort of Google for Business Central’s world. Use it to get a summarized answer for various topics, both functional and technical.

There’s still time!

Don’t forget to register for Days of Knowledge Americas 2024 on September 12-14 in Atlanta, Georgia. Network with other Business Central consultants and developers and attend training sessions you won’t find anywhere else. See you there!

++++++++++++++++++++

Are you interested in Dynamics NAV and Business Central development? Check out 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
*required
Last Name
*required
Email
*required
Subscription Options
Your Privacy is Guaranteed