Entradas

Mostrando entradas de febrero, 2024

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...