Dynamics NAV / Business Central Developer Digest - Vol 365

The Developer Digest by ArcherPoint focuses each week on Microsoft Dynamics 365 Business Central development and Dynamics NAV development, contributed by our technical professionals. In Developer Digest Volume 365, we discuss transmitting an EFT file from BC SaaS to SMTP server and more.
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/BC 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.
Setting Up Transmission of an EFT File from Business Central SaaS to an SFTP Server
Ian asks: “Has anyone set up a transmission of an EFT file from BC SaaS to an SFTP server? I’ve done this before with WinSCP and scripting, but I’m not sure how this would be done via BC SaaS. Has anyone done this with the SaaS version? Maybe an add-on? I know they could just download the file and send it manually, but the client is asking for it to be automated. Any tips would be appreciated :).”
Matt T replies: “I’ve looked a few times, but never ended up doing it. I’m pretty sure it has to be something like this: Dynamics 365 Business Central SaaS: save a file to an SFTP server – Stefano Demiliani”
Enabling the Status Field without Using the Actions in the Ribbon in Business Central
In his latest blog post, Enabling Status Field – Business Central Geek, the Business Central Geek (“Alberto”) explains that it’s somewhat common to get lost in the ribbon looking for action buttons. But if you know the name of what you’re looking for, you can find it with the help of ‘Tell me’. Here, he explains how to change the status of a document without using the actions in the ribbon.
Automatic Terms and Conditions Attachment for Emailed Invoices
Kyle shares: ”Developer Tip of the Day: Automatic Terms and Conditions Attachment for Emailed Invoices
Using the new email module that started in BC18, you can do this in a simple and SaaS-friendly way. No more exporting to a file—you can keep everything in streams:”
[EventSubscriber(ObjectType::Codeunit, Codeunit::”Document-Mailing”, ‘OnBeforeSendEmail’, ”, true, true)]
local procedure OnBeforeSendEmail(var TempEmailItem: Record “Email Item” temporary; var IsFromPostedDoc: Boolean; var PostedDocNo: Code[20]; var HideDialog: Boolean; var ReportUsage: Integer)
var
Setup: Record “ARC Setup”;
TempBlob: Codeunit “Temp Blob”;
Attachments: Codeunit “Temp Blob List”;
AttachmentNames: List of [Text];
ReportUsageEnum: Enum “Report Selection Usage”;
PDFOutStream: OutStream;
AttachmentLbl: Label ‘Terms and Conditions.pdf’;
begin
if ReportUsage = ReportUsageEnum::”S.Invoice” then begin
Setup.Get();
if Setup.”S.Invoice Terms and Conditions”.HasValue() then begin
Clear(Attachments);
Clear(AttachmentNames);
Clear(TempBlob);
Clear(PDFOutStream);
TempBlob.CreateOutStream(PDFOutStream);
Setup.”S.Invoice Terms and Conditions”.ExportStream(PDFOutStream);
// Add, don’t overwrite
TempEmailItem.GetAttachments(Attachments, AttachmentNames);
Attachments.Add(TempBlob);
AttachmentNames.Add(AttachmentLbl);
TempEmailItem.SetAttachments(Attachments, AttachmentNames);
end;
end;
end;