The views and opinions expressed in this blog are those solely of the author(s) and do not necessarily reflect Microsoft’s current policy, position, or branding. For official announcements and guidance on Dynamics 365 apps and services, please visit the Microsoft Dynamics 365 Blog.
Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 release wave 1Discover the latest updates and new features to Dynamics 365 planned through September 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
This blog post is tightly connected to one of my previous posts:
Microsoft is trying to make our life easier from an upgrade perspective with merge commandlets and upgrade codeunits. This is nice but sometimes you run into situations that are not fixable with tools like these.
I am currently upgrading one of my older customers from NAV2009R2 classic to NAV2016. Some code goes back to 3.60 and reports to 2.x.
During this upgrade I run into a number of issues that are disruptive to merge commandlets, even if I were using pages, even if I were using extensions and eventing.
This has everyting to do with Microsoft refactoring. There are three major application areas they have refactored that blow up my upgrade.
This post is about SMTP Email. Dimensions we all know, I don’t think I have to write more of that.
To “fix” sending emails with SMTP there is a shortcut and a “new way”.
Let me show the shortcut first.
In NAV2016 the function AddAttachment has one extra parameter
Simple fix. But if you want SMTP in NAV2016 you really should use something else.
As I mentioned in my post, Microsoft is starting to use a table as a class grouping arguments in a table to pass into a function. This is called “argument tables” and described in my blog and Master Class.
Using Argument Tables | Introducing Overloading in Dynamics NAV
The example is a new table Email Item (9500) that helps you with sending emails.
Idea is to populate the fields of the table and then use the Send method.
There are advantages of using this, for example, you can enable editing the email in outlook. This is optiona.
It also has some flaws.
One downside of working with argument tables is that you need a line of C/AL code per argument to populate.
With SMTP email you often have default sender and reply addresses such as the company name and a noreply@ address.
The Arguments table allows you to add a body. This is a long text. It is often usefull to populate the body line-by-line. Especially if you do HTML formatting.
The result looks something like this
EmailItem.Subject := NotTxt.Subject + "Invoice No.";
EmailItem."Send to" := "Email Address";
NotTxtLn.SETRANGE("Text Code", NotTxt.Code);
NotTxtLn.SETRANGE("Text No.", NotTxt."Text No.");
IF NotTxtLn.FINDSET THEN
UNTIL NotTxtLn.NEXT = 0;
Please note that I also use a very old version of notifications. This was discontinued somewhere after Navision 4.0. I have to upgrade this to the new Notification. Another thing that broke my “Easy Upgrade” since it was bringing in objects with name conflicts.
There is a small naming issue. “Send to” should have been “Send To”. Must have slipped code review.
The Arguments table also does not support multiple attachements.
If you want to send your email in HTML format, you cannot open it in the UI. This is the (TRUE) parameter of the Send method.
Remember my dear students in the Master Class! UI Separation. ;-)
Business Applications communities