Thursday, 21 October 2021

Visual Studio Code is now available on the web. No more OS dependency .

 Visual Studio Code is now available on the web. No more OS dependency .



Source:

Bringing VS Code to the browser#

Fast forward to today. Now when you go to https://vscode.dev, you'll be presented with a lightweight version of VS Code running fully in the browser. Open a folder on your local machine and start coding.

No install required.

Readmore

Sunday, 19 September 2021

Convert each word's first letter in Capital

 Convert each word's first letter in Capital

Below is the code

Name DataType Subtype Length

nametext Text

newtext Text

ucase Text

textlen Integer

Convertext Text


nametext := 'first letter of this line going to be converted in Capital.';

WHILE STRPOS(nametext,' ') <> 0 DO BEGIN

  newtext := UPPERCASE(COPYSTR(COPYSTR(nametext,1,STRPOS(nametext,' ')-1),1,1));

  newtext += LOWERCASE(COPYSTR(nametext,2,STRPOS(nametext,' ')-2)) + ' ';

  Convertext += newtext;

  textlen := STRLEN(newtext);

  nametext := DELSTR(nametext,1,textlen);

END;

ucase := UPPERCASE(COPYSTR(nametext,1,1));

ucase += LOWERCASE(COPYSTR(nametext,2,STRLEN(nametext)));

MESSAGE(Convertext+ucase);











Monday, 12 July 2021

Create vCard QR Codes using Azure Functions

Create vCard QR Codes using Azure Functions

 QR Code Generation in BC with Azure functions


Source : https://carlos.mendible.com/2016/08/28/create-vcard-qr-codes-using-azure-functions/


1. Create a Function App


Head to portal.azure.com and hit the New button. Search for Function App and create one. You’ll be asked for an app name, resource group, app service plan and storage account where the code will live.

2. Create the function


Create a new Function, selecting the empty C# template and give it a name: (i.e QRCoder)

3. Add the code


Replace the contents of the Code (run.csx) section with the following code and save it:

Sunday, 11 July 2021

Generate QR Code from NAV 2016

 How to General QR Code from NAV 2016


1. Using of Microsoft.Dynamics.Nav.MX.dll, you can find the DLL fine the below path from your installation folder or from the DVD folder.

...ServiceTier\program files\Microsoft Dynamics NAV\90\Service\Add-ins\ElectronicInvoice


Create a Codeunit object or use any object to create below functions.

CreateQRCodeInput

GetQRCode

GetBarCodeProvider

MoveToMagicPath

GenerateQRCode

LOCAL CreateQRCodeInput(Name : Text;VATNo : Text;InvDateTime : Text;TotalAmt : Text;VATAmt : Text) QRCodeInput : Text[1024]

Var Name DataType Subtype Length

No Name Text

No VATNo Text

No InvDateTime Text

No TotalAmt Text

No VATAmt Text

QRCodeInput :='Seller Name:' + Name + ';' +'VAT No.:' + VATNo + ';' +'TimeStamp:' + InvDateTime + ';' +'Total Amt:' + TotalAmt + ';' + VATAmt;


LOCAL GetQRCode(QRCodeInput : Text) QRCodeFileName : Text[1024]

Parameters:

Var Name DataType Subtype Length

No QRCodeInput Text

Local Variables:

Name DataType Subtype Length

 Set RunOnClient = Yes on DotNetVariables

IBarCodeProvider DotNet Microsoft.Dynamics.Nav.MX.BarcodeProviders.IBarcodeProvider.'Microsoft.Dynamics.Nav.MX, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'



GetBarCodeProvider(IBarCodeProvider);

QRCodeFileName := IBarCodeProvider.GetBarcode(QRCodeInput);


LOCAL GetBarCodeProvider(VAR IBarCodeProvider : DotNet "Microsoft.Dynamics.Nav.MX.BarcodeProviders.IBarcodeProvider")

Parameters:

Var Name DataType Subtype Length

 Set RunOnClient = Yes on DotNetVariables

Yes IBarCodeProvider DotNet Microsoft.Dynamics.Nav.MX.BarcodeProviders.IBarcodeProvider.'Microsoft.Dynamics.Nav.MX, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Local Variables:

Name DataType Subtype Length

QRCodeProvider DotNet Microsoft.Dynamics.Nav.MX.BarcodeProviders.QRCodeProvider.'Microsoft.Dynamics.Nav.MX, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

 QRCodeProvider := QRCodeProvider.QRCodeProvider;

IBarCodeProvider := QRCodeProvider;


LOCAL MoveToMagicPath(SourceFileName : Text) DestinationFileName : Text[1024]

Parameters:

Var Name DataType Subtype Length

No SourceFileName Text



Local Variables:

Name DataType Subtype Length

FileSystemObject Automation 'Windows Script Host Object Model'.FileSystemObject


DestinationFileName := ThreeTierMgt.ClientTempFileName(',');

IF ISCLEAR(FileSystemObject) THEN

  CREATE(FileSystemObject,TRUE,TRUE);

FileSystemObject.MoveFile(SourceFileName,DestinationFileName);


GenerateQRCode(InvDateTime : Text;TotalAmt : Text;VATAmt : Text;VAR TempBlob : Record TempBlob)

Parameters:

Var Name DataType Subtype Length

No InvDateTime Text

No TotalAmt Text

No VATAmt Text

Yes TempBlob Record TempBlob


Local Variables:

Name DataType Subtype Length

CompanyInfo Record Company Information

SalesInvoiceHeader Record Sales Invoice Header

QRCodeInput Text

QRCodeFileName Text


// Save a QR code image into a file in a temporary folder

CompanyInfo.GET;

CompanyInfo.TESTFIELD("VAT Registration No.");

QRCodeInput := CreateQRCodeInput(CompanyInfo.Name,CompanyInfo."VAT Registration No.",InvDateTime,TotalAmt,VATAmt);

QRCodeFileName := GetQRCode(QRCodeInput);

QRCodeFileName := MoveToMagicPath(QRCodeFileName); // To avoid confirmation dialogue on RTC


// Load the image from file into the BLOB field

CLEAR(TempBlob);

ThreeTierMgt.BLOBImport(TempBlob,QRCodeFileName);


// Erase the temporary file

IF NOT ISSERVICETIER THEN

  IF EXISTS(QRCodeFileName) THEN

    ERASE(QRCodeFileName);

In My case I am using Table 112 (Sales Invoice Header)  and one custom report to Generate and print the QR code in the report.

Expanded Data Type Data Source Name Include Caption

1 DataItem Sales Invoice Header <Sales Invoice Header> No

0 Column "Sales Invoice Header"."QR Code" QRCode_SalesInvoiceHeader No

0 Column "Sales Invoice Header"."Sell-to Customer No." SelltoCustomerNo_SalesInvoiceHeader No


Insert a Image in the report designer and Calcfield on TempBlob report


I have added a button on Posted Sales Invoice Page 132


Local Variables:

Name DataType Subtype Length

QRCodeMgmt Codeunit QR Code Mgmt.

TempBlob Record TempBlob


<Action1170000000> - OnAction()

CALCFIELDS("Amount Including VAT",Amount);

QRCodeMgmt.GenerateQRCode(FORMAT(CURRENTDATETIME),FORMAT("Amount Including VAT"),FORMAT("Amount Including VAT" - Amount),TempBlob);

"QR Code" := TempBlob.Blob;

MODIFY;

COMMIT;

REPORT.RUNMODAL(REPORT::"Print QR Code",TRUE,FALSE,Rec);


OutPut






Monday, 28 June 2021

AL publishing error " Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong."

Sometimes if need to remove columns or fields from Table and try to compile and publish the AL extension again we face below error.


Error


 Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong.


Why it happens?


The object metadata in Sql sever could be different from that of your object.

sometime SQL does not recognize the columns or sync same time


What is the solution?


Try to put below parameter in launch.json in your AL extension file.








Hope it help and let me know for more details if we can add it here.



Tuesday, 18 May 2021

Using Microsoft Translations in VS AL Code

 

SHOW MICROSOFT TRANSLATIONS IN VS CODE

his post is especially interesting for the people whose native language is not English. Do you know the feeling? You are looking at the source code of some .al object and you come across a field name that means absolutely nothing to you. It would be helpful for you if you could see the translation of this field name into your native language. Often this is already sufficient. In the old C/SIDE client we had the field “Caption” in the table designer to see the translation.


AL Navigator: Open/Show Microsoft Translation





Tuesday, 4 May 2021

Creating a Business Central Incoming document with attachment via BC Webservice.

Creating a Business Central Incoming document with attachment via BC Webservice.

Hey guys...

Today I am trying to create an incoming document in business central with the attached file of an extension like .pdf or .docx file, via publishing one codeunit webservice and consumed by other software or powerautomate.

Below are some steps to be followed

1. Create BC codeunit webservice with custom method in it and publish it

2. Consume this webservice via power automate and generate JSON object text

3. supply JSON object as text in the codeunit method.

4. Process the JSON object and start creating incoming document.





document:text will have a JSON text in the body as a parameter I am here also pasting my JSON objects with the proper format and the result what I am getting after using POST method as per below




Result:

Note: Please make sure header part should have parameter as mentioned below, if you are trying wizdler to use POST method, no need to use this method as wizdler(WSDL) automatically format.

Download Wizdler here for chrome extension.
Download Postman here.




After processing above I am getting my incoming document created as per below screenshot.








Extension Unpublished/Uninstalled history required in BC Production environment

  There is a situation when someone can uninstall or unpublish any APP extension from the extension management in Production environment, th...