Guidelines for Partners
As you probably have noticed, once you upgrade your extension from previous Business Central versions to BC20, their various errors should appear that need to be refactored. So in this article, I will present the most common cases and how to rework them when you upgrade the extension to the Business Central 20 OnPrem version.
First of all, let’s talk about the OnPrem cases. One of the most common issues is an SMTP mailing functionality which has been removed from the Base Application and separated into two new standard apps called “SMTP API” and “SMTP Connector.” So you have to install those two apps in your solution to access SMTP mailing functionality. The usual approach would be to use an interface “Email Connector” to point at the SMTP module and send an email using a standard mailing module: “Email Message,” “Email Account.” The most crucial part is that you will have to set up an SMTP Mail user via the Web Client. Since we have already written a guideline about the SMTP rework, you can find more information about it here.
Another major issue appears with the Codeunit 419 “File Management.” All procedures that work with local computer files and folders are no longer supported. For example, if you want to create, move, delete a file or directory on your local computer, you will no longer be able to achieve this. However, some functionalities can be reworked to give the same or similar results as before. For example, suppose previously we wanted a file to be created on the local machine. In that case, we can still make it on the server side, write something in it or perform other actions; then we can download it to the default “Downloads” folder, which gives pretty much the same result, only the file will not be located in your specified directory. Let’s take a look at the example.
As you can see from the picture, instead of specifying a local computer path to create a text file, we can create a server file, write something to it and then download it using the “File Management” procedure DownloadHandler. The same goes with DeleteFile, MoveFile, CreateDirectory, and other procedures – you can manage files on the server side and download the file if needed. Here is the short memo of possible workarounds for specific file management procedures:
Client side | Server side |
CopyClientFile | CopyServerFile |
MoveFile | CopyServerFile (delete primary afterward) |
DeleteClientFile | DeleteServerFile |
ClientFileExists | ServerFileExists |
ClientDirectoryExists | ServerDirectoryExists |
CreateClientDirectory | ServerCreateDirectory |
DeleteClientDirectory | ServerRemoveDirectory |
IsClientDirectoryEmpty | IsServerDirectoryEmpty |
OpenFileDialog | UploadFile or UploadFileWithFilter |
On the other hand, some procedures regarding file management cannot be reworked without using external file storage such as OneDrive, Google Drive, and others:
- SaveFileDialog – can be reworked using DownloadHandler, but will download to the default path.
- BrowseForFolderDialog – does not work anymore.
- UploadFileSilent – does not work anymore. The only approach is UploadFile which does not upload files silently (without a dialog window).
- UploadFileSilentToServerPath – does not work anymore. The only approach is using UploadFile, which does not upload files silently.
- SelectFolderDialog – does not work anymore.
Other breaking changes:
Object | Obsolete procedure | Workaround |
Table 37 “Sales Line” |
CrossReferenceNoLookUp | ItemReferenceMgt.SalesReferenceNoLookup(Rec); |
Table 77 “Report Selections” |
FindPrintUsage | FindReportUsageForCust |
Table 77 “Report Selections” |
FindPrintUsageVendor | FindReportUsageForVend |
Table 77 “Report Selections” |
FindEmailAttachmentUsage | FindEmailAttachmentUsageForCust |
Table 77 “Report Selections” |
FindEmailAttachmentUsageVendor | FindEmailAttachmentUsageForVend |
Table 77 “Report Selections” |
FilterEmailUsage | SetEmailUsageFilters |
Table 77 “Report Selections” |
FilterEmailBodyUsage | SetEmailBodyUsageFilters |
Table 77 “Report Selections” |
FilterEmailAttachmentUsage | SetEmailAttachmentUsageFilters |
Table 77 “Report Selections” |
FindEmailBodyUsage | FindEmailBodyUsageForCust |
Table 77 “Report Selections” |
FindEmailBodyUsageVendor | FindEmailBodyUsageForVend |
Table 77 “Report Selections” |
PrintWithCheck | PrintWithCheckForCust |
Table 77 “Report Selections” |
PrintWithGUIYesNoWithCheck | PrintWithDialogWithCheckForCust |
Table 77 “Report Selections” |
PrintWithGUIYesNoWithCheckVendor | PrintWithDialogWithCheckForVend |
Table 77 “Report Selections” |
PrintWithGUIYesNo | PrintWithDialogForCust |
Table 77 “Report Selections” |
PrintWithGUIYesNoVendor | PrintWithDialogForVend |
Table 77 “Report Selections” |
GetHtmlReport | GetHtmlReportForCust |
Table 77 “Report Selections” |
GetPdfReport | GetPdfReportForCust |
Table 77 “Report Selections” |
GetEmailBody | GetEmailBodyForCust |
Table 77 “Report Selections” |
GetEmailBodyCustomText | GetEmailBodyTextForCust |
Table 77 “Report Selections” |
GetEmailBodyVendor | GetEmailBodyForVend |
Table 870 “Social Listening Setup” |
Discontinued | |
Table 871 “Social Listening Search Topic” |
Discontinued | |
Table 5717 “Item Cross Reference” |
Use table “Item Reference” | |
Table 9650 “Custom Report Layout” |
Discontinued | |
Page 870 “Social Listening Setup” |
Discontinued | |
Page 871 “Social Listening Search Topic” |
Discontinued | |
Page 875 “Social Listening FactBox” |
Discontinued | |
Page 876 “Social Listening Setup FactBox” |
Discontinued | |
Page 5721 “Item Cross Reference Entries” |
Use Page “Item Reference Entries” | |
Page 9080 “Sales Hist. Sell-to FactBox” |
SetCustomerNoVisibility | Discontinued, but can be copied to page extension or reimplement to set visibility |
Page 9081 “Sales Hist. Bill-to FactBox” |
SetCustomerNoVisibility | Discontinued, but can be copied to page extension or reimplement to set visibility |
Page 9082 “Customer Statistics FactBox” |
SetCustomerNoVisibility | Discontinued, but can be copied to page extension or reimplement to set visibility |
Page 9084 “Customer Details FactBox” |
SetCustomerNoVisibility | Discontinued, but can be copied to page extension or reimplement to set visibility |
Codeunit 871 “Social Listening Management” |
Discontinued | |
Codeunit 6620 “Copy Document Mgt.” |
CopyPurchLine | CopyPurchDocLine |
Codeunit 6620 “Copy Document Mgt.” |
CopySalesLine | CopySalesDocLine |
Codeunit 6620 “Copy Document Mgt.” |
PurchHeaderDocType | GetPurchaseDocumentType |
Codeunit 6620 “Copy Document Mgt.” |
ArchPurchHeaderDocType | GetPurchaseDocumentType |
Codeunit 6620 “Copy Document Mgt.” |
SalesHeaderDocType | GetSalesDocumentType |
Codeunit 6620 “Copy Document Mgt.” |
ArchSalesHeaderDocType | GetSalesDocumentType |
These are the most common cases when converting your extensions solution to the Business Central 20 OnPrem version. In my opinion, this version has quite significant changes compared to the previous ones because file management, cross references, and SMTP mailing are frequently used in customized Business Central solutions.