Wednesday, August 19, 2020

Why Business Central Is Amazing #3 - No Access to SQL Server

 By Steve Endow

"What? Are you crazy, Steve? Not having access to SQL is a limitation! It's a weakness! That's not amazing!"

I am not trying to change anyone else's mind--I'm just sharing a few thoughts why I think that NOT having access to SQL Server is amazing.

I've been working with on-prem ERP systems since 1996, when I implemented Solomon IV for Windows, then MAS 90, then Peoplesoft, then Dynamics GP.  I'm aware of all the arguments for wanting or needing access to SQL. I get it.

But that direct access comes at significant cost.  And responsibility.  And risk.  And those things are not amazing.  Mid-market companies want to sell their product or service, to provide customer satisfaction, and to make revenue.  

They don't want to be in the ERP database administration business.  Or the ERP database backup business.  Or the ERP disaster recovery business.  Or the ransomware defense business.

Do you really want to be in the database administration and maintenance business?

Tuesday, August 18, 2020

Why Business Central Is Amazing #2 - No More VPNs!

By Steve Endow

I have an ERP joke for you...

Find a consultant who supports an on premises ERP application for dozens or hundreds of customers.

Ask them which of the 7 different VPN clients on their laptop is their favorite.

(rim shot)  

Just say no

Monday, August 17, 2020

Why Business Central Is Amazing #1 - Automatic Upgrades

 By Steve Endow

After seeing a few very cool Business Central features the other day, I was so impressed and in such a good mood that I might have posted a slightly overly enthusiastic tweet.

Can't a guy be in a really good mood?

Does Business Central do my dishes?  My laundry?  Paint my house?

Sadly, it does not.  Yet.  😉

But it does do lots of awesome things and it has some amazing features and benefits.  And after posting my happy tweet, I think a few people are wondering why I think Business Central is so amazing.

So now I feel obligated to explain why I think it's amazing, and in the process, share my enthusiasm for the new ERP platform that I'm learning about.

Saturday, August 15, 2020

Updating from NavContainerHelper to the new BcContainerHelper

 By Steve Endow

UPDATE: If you're interested in a convenient way to run the BcContainerHelper PowerShell commands, check out Krzysztof's Azure Data Studio Notebook with sample BcContainerHelper commands.  Jupyter Notebooks are a great way to include documentation and commands in a single convenient format.

On August 11, 2020, Freddy Kristiansen announced that he had released BcContainerHelper.

You can read his blog post here:

          https://freddysblog.com/2020/08/11/bccontainerhelper/

You will definitely want to read the entire blog post carefully, and perhaps read it a few times, as he shares quite a few important details about the new BcContainerHelper.

Same Great Container Helper, But Updated and Upgraded!


I made a video showing how I updated from NavContainerHelper to BcContainerHelper.  The process went flawlessly.


Here are the PowerShell Docker commands that I used to perform my update.

Sunday, August 9, 2020

Learning Business Central Development from Scratch Video Series

By Steve Endow

If you are new to Dynamics 365 Business Central development, join me on a journey to learn how to develop Business Central Extensions using VS Code and the AL language.

I have been developing business software for many, many years, but I am completely new to Business Central, AL, and VS Code.  And I am also new to Docker and PowerShell.  

Basically, I'm having to learn everything from scratch.  

I'm writing blog posts and making videos to share the learning resources I'm using and share my learning journey.

Tuesday, August 4, 2020

Business Central Download Symbols Error: No such host is known

By Steve Endow


UPDATE:  After researching this type of Windows hosts file name resolution issue, it seems there are dozens of possible reasons why the problem can occur.  I suspect my case was one of the simpler versions, and fortunately flushdns worked for me.  Here is a forum thread with examples of several rather odd causes and solutions.


This morning I tried to create a new Business Central AL project in VS Code.  I used AL Go! to create the project, set the server name in the launch.json file, and then tried to Download Symbols.

Very simple, very easy, right?

Nope.

No soup for you!

What? I performed these exact same steps 2 days ago on this same machine, and I was able to download symbols without any issues.

Here is the full video of the troubleshooting process:




I closed VS Code, relaunched it, created a new project, and tried again.  Same error.

Looking at the error log in VS Code, I saw "Error: No such host is known".  Say what?

Monday, August 3, 2020

Automatically Update BcContainerHelper - Improved Script

By Steve Endow

UPDATE: I have updated the script to work with the newer BcContainerHelper rather than the older NavContainerHelper


UPDATE: If you're interested in a convenient way to run the BcContainerHelper PowerShell commands, check out Krzysztof's Azure Data Studio Notebook with sample BcContainerHelper commands.  Jupyter Notebooks are a great way to include documentation and commands in a single convenient format.


I previously wrote about creating a simple scheduled task to automatically update NavContainerHelper.

While that simple script does work, it didn't have any logging or notification. I never knew when NavContainerHelper / BcContainerHelper was updated.

I recently created a fancier PowerShell script to automatically build my Business Central Docker Containers every day, and while working on that script, I learned how to record elapsed time, log all activity, and send an email notification.

Based on that new learning, I wanted to upgrade the script that updates BcContainerHelper.

I wanted logging, elapsed time, and email notification if BcContainerHelper was updated to a new version.

Email notification when an update occurs


Here's what I came up with.  You'll need to adjust the file paths and email address, and generate your own email password file.

If you think of any other features the update could have, let me know!

#v2.0 - June 22, 2021
#
$server = $env:COMPUTERNAME
#Define date values
$simpleDate = Get-Date -Format "M/d/yy"
$dateTime = Get-Date -Format "M/d/yy HH:mm"
$fileDateTime = Get-Date -Format "yyyy-MM-dd HHmm"

#Define the module name
$moduleName = 'BcContainerHelper'

$body = ""
$message = ""
$updated = $false

#Specify file location for activity transcript log file
$transcriptFile = "D:\BCPowerShell\Logs\" + $fileDateTime + " " + $server + " " + $moduleName + " Update Log.txt"

#Start recording transcript
Start-Transcript -Path $transcriptFile

#Record the start time
$StartTime = $(get-date)


#Define email configuration
$emailFrom = "myemail@gmail.com"
$emailTo = "myemail@gmail.com"
$smtpServer = "smtp.gmail.com"
$port = "587"
#Email password file created using:  Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File -FilePath D:\BCPowerShell\Gmail.securestring
$passwordFile = "D:\BCPowerShell\Gmail.securestring"
$securePassword = ConvertTo-SecureString (Get-Content -Path $passwordFile)
$smtpCred = New-Object -TypeName PSCredential ($emailFrom, $securePassword)

$subject = $server + ": " + $simpleDate + " " + $moduleName + " Update Log";

$started = "Start time: " + $StartTime
$body += $started + "`n`n"

Try
{
    #Get currently installed version
    $currentVersion = (Get-InstalledModule $moduleName -ErrorAction SilentlyContinue).Version.ToString()
}
Catch 
{
    $currentVersion = "(not installed)"
}

$oldVersion = $currentVersion

#Get the latest version available
$latestVersion = (Find-Module $moduleName).Version.ToString()


#If we don't have the latest version installed
If ($currentVersion -ne $latestVersion)
{

    $message = "Current version: " + $currentVersion + "`nLatest version: " + $latestVersion;
    $message += "`n`nUpdating to version " + $latestVersion;
    #Remove existing version(s)
    Uninstall-Module $moduleName -Force -AllVersions -ErrorAction SilentlyContinue

    #Install latest version
    Install-Module $moduleName -Force

    $updated = $true;

    #Verify version number
    $newVersion = (Get-InstalledModule $moduleName).Version.ToString()
    $message += "`nUpdate complete";
    $message += "`nCurrent version is now " + $newVersion;
        
    $body += "`n" + $message;

    Write-Output $message
}
Else
{
    #If we are on the latest version, log that info
    $message = "You are on the latest version of " + $moduleName + ": " + $newVersion;
    Write-Output $message
}



#Record end time
$EndTime = $(get-date)
$output = "`nEnd time: " + $EndTime
$body += "`n" + $output 
Write-Output $output 

#Calculate elapsed time
$elapsedTime = $EndTime - $StartTime
$totalTime = "{0:HH:mm:ss}" -f ([datetime]$elapsedTime.Ticks)
$output = "Elapsed time: " + $totalTime
$body += "`n" + $output 
Write-Output $output

$body += "`n`nFull log file is attached" 

#Finish the transcript recording
#The Transcript must be stopped before trying to send the email,
#otherwise the log file will be locked, causing the email to fail
Stop-Transcript
        
if ($updated)
{
#Send the email
Send-MailMessage -From $emailFrom -To $emailTo `
    -Subject $subject `
    -Body $body `
    -Attachments $transcriptFile `
    -SmtpServer $smtpServer `
    -Credential $smtpCred `
    -Port $port `
    -UseSsl
}  


Steve Endow is a Microsoft MVP in Los Angeles.  He works with Dynamics 365 Business Central, Microsoft Power Automate, Power Apps, Azure, .NET, Dynamics GP, and SQL Server.

You can also find him on Twitter and YouTube

https://www.precipioservices.com

How many digits can a Business Central Amount field actually support?

 by Steve Endow (If anyone has a technical explanation for the discrepancy between the Docs and the BC behavior, let me know!) On Sunday nig...