Entradas

How to Print Multiple Copies in Report in AL of Microsoft Dynamics 365 Business Central

Imagen
  How to Print Multiple Copies in Report in AL of Microsoft Dynamics 365 Business Central (MSDYN365BC)? There are two parts in report AL Code RDL Layout (Similar to NAV). AL Code I have pasted the AL code for the Item List report. report 50129 ItemListReport {     UsageCategory = ReportsAndAnalysis;     ApplicationArea = All;     CaptionML = ENU = 'AL Item List ';     DefaultLayout = RDLC;     RDLCLayout = './ItemListReport.rdl';     dataset     {         dataitem(Item; Item)         {              dataitem(CopyLoop; "Integer")             {  ...

How to send emails with attachments in Business Cental AL

Imagen
Many times we find ourselves with the need to send a document from Business Central with attached files, from Sales Orders, Purchases or some other document. Below I will share a solution which works for the aforementioned. The following example is based on generating a Sales Confirmation and sending an email with two attachments. The first thing we will do is attach two files from the Sales Order. Then, from the new action created "Send Confirmation With Attachments", we press to send the email with the two attachments. When you execute the action, an email will arrive with the sales confirmation and the two attached data. From the AL code, we can customize the email sending with images or a more appropriate email body for the company. Below I link the source code. https://github.com/juancamilo0519/SendAttachWithBusinessCentral //How to Do in Business Central By Juan Camilo Camargo A. pageextension 50101 SalesOrderExt extends "Sales Order" {     actions     { ...

How to open any document in OneDrive from Business Central

Imagen
https://github.com/juancamilo0519/OpenInOneDrive   The following post explains how to open any document, in this case a Sales Order, from OneDrive in order to immediately share it with our work team: By pressing the Open in Onedrive button, Business Central will ask if we agree to use our OneDrive in our environment. Finally, our document opens directly from OneDrive and we can share it with our work team. Below is the source code: https://github.com/juancamilo0519/OpenInOneDrive //Whith this solution you can copy the file to your bussiness central folder in OneDrive and open it in a new windows. pageextension 50100 SalesOrderExt extends "Sales Order" {     actions     {         addlast ( "O&rder" )         {             action ( OpenInOneDrive )             {                 ApplicationArea = all;     ...

How to update the daily exchange rate by consuming web services from any bank.

Imagen
Financial management users have the daily task of updating the exchange rate with respect to any foreign currency, however, this task is often done manually. In the next post, I will explain the simple way to consume a central bank web service in this case of Mexico (It works for any country) and updates the exchange rate table. It is important to know that for it to be done automatically, you simply need to expose a Job Queue that executes this update task daily. Below the source code: procedure GetRateforDateBanxico() var Client: HttpClient; Response: HttpResponseMessage; ContentTxt: Text; Root: JsonObject; CurRate: Decimal; CurRateTxt: text; CurDateTxT: Text; ExchangeRate: Record "Currency Exchange Rate"; BMSetup: Record "GetCurrfromBM Setup"; Pos: Integer; PosD: Integer; begin BMSetup.Get(); if Client.Get('https://www.banxico.org.mx/SieAPIRest/serv...

Join two or more PDFs into one in Business Central

Imagen
In the next post we will explain how to join two PDFs into one, we will take as an example the generation of a Sales Order in PDF and Sales Invoice in the same format. First we will create the codeunit as follows: Then we will create a page where we will generate the pdf of the Sales Order and the Sales invoice: page 50148 MergePDF {     Caption = 'MergePDF';     PageType = Card;     layout     {         area(content)         {             group(General)             {                 usercontrol(pdf; PDF)                 {                     ApplicationArea = all;                     trigger DownloadPDF(pdfToNav: text)               ...

Connect An External Database To Business Central

Imagen
First of all, we need to create a table in Business Central. As an example, we will connect to an older version of Nav and get the customers from the database. The table type will be ‘ExternalSQL’ and the external name will be the same that it´s in SQL Server (Company Name + Table Name). Add the fields you wish to retrieve from the Sql table. This step is quite delicate, you need to have the same data types between SQL Server and Business central fields. Otherwise, the system will display an error and the connection won´t be stablished. (varchar = text or code, unique identifier = guid, and so on). The names of the fields can differ from the ones of Sql but if you do so, then, the field property ‘ExternalName’ must be filled. An example of a table would look like this. Note that if there is no primary key, BC will assing it to the first field. Create the connection First, you need to identify the Sql server, instance (if local server) and database name you will connect to: Then, if you...