Search This Blog

Format Amount in Indian Style on Navision - RDLC

Unlike the Arab styling of numbers which places a comma on each thousand (1000’s), the Indian way of styling numbers is different and is used only by India, Nepal, Pakistan, Bangladesh and Sri Lanka.
Currently, NAV does not support the Indian Numbering Style on Reports or must I say that RDLC doesn’t have any provision.
The following piece of code enables you to format Amounts in Indian Style of Numbering.
______________________________________________________________________
Variables
NameDataTypeSubtypeLength
AmtInTextText50
DecPlacesText3
StopBoolean
DummyAmtDecimal
DummAmtInTextText50
iInteger
DivByInteger
_____________________________________________________________________
Code
DecPlaces := ‘.00’;
AmtInText := FORMAT(Amt);
AmtInText := DELCHR(AmtInText,’=’,’,’);
IF STRPOS(AmtInText,’.’) 0 THEN BEGIN
   AmtInText := COPYSTR(AmtInText,1,STRPOS(AmtInText,’.’)-1);
   DecPlaces := COPYSTR(AmtInText,STRPOS(AmtInText,’.’),STRLEN(AmtInText));
END;

RetAmtVal := FORMAT(Amt);
RetAmtVal := DELCHR(RetAmtVal,’=’,’,’);
i := 1;
DivBy := 1000;
REPEAT
   CLEAR(DummAmtInText);
   CLEAR(DummyAmt);
   IF i = 1 THEN BEGIN
      DummyAmt := Amt/DivBy;
       i +=1;
   END ELSE BEGIN
      DivBy := DivBy * 100;
      DummyAmt := Amt/DivBy;
      i +=1;
   END;
   IF DummyAmt < 1 THEN
      Stop := TRUE
   ELSE BEGIN
      DummAmtInText := FORMAT(DummyAmt);
      DummAmtInText := DELCHR(DummAmtInText,’=’,’,’);
      IF STRPOS(DummAmtInText,’.’) 0 THEN
         DummAmtInText := COPYSTR(DummAmtInText,1,STRPOS(DummAmtInText,’.’)-1);
      RetAmtVal := INSSTR(RetAmtVal,’,’,STRLEN(DummAmtInText) + 1);
   END;
UNTIL Stop;
RetAmtVal := RetAmtVal + DecPlaces;

Resolved - Post GST Reconciliation Bug in Dynamics NAV IN Build 9.00.48466

This bug came to us when we posted an GST settlement entry and our General Ledger Setup was deleted.

Yes, that`s really a big problem as General Ledger Setup is the most important part of Navision.

We tried to debug the process & find the code but was not getting anywhere.

But just as we were about to give up, we noticed that there was a field in Table ID - 16433 (GST Reconciliation) -  "GST Recon. Tolerance" in which if a value is validated then only General Ledger Setup was getting deleted.

We checked the code on the - OnValidate() Trigger of the field on the table given below is what we found -


Solution : Remove the code from OnValidate() Trigger of field "GST Recon. Tolerance" from Table ID - 16433 (GST Reconciliation).



How to create NAV Instances with multiple builds in the same machine for the same Navision Version (Through PowerShell)

The concepts described in this post are applicable to different versions/builds, for examples I will use an installation of Microsoft Dynamics Navision 2016 (9.00.50458) AU version and I will create one more instances also for the Microsoft Dynamics Navision 2016 (9.00.48466) IN version on the same machine.

Prerequisites:
  • Microsoft Dynamics Navision 2016 (9.00.50458) AU version should be installed on the machine as the base version.
  • Microsoft Dynamics Navision 2016 (9.00.48466) IN version setup downloaded from Microsoft Partner Source website.

Solution :

After you installed Navision 2016 (9.00.50458) AU version it`s Service files will be inside the following path:

C:\Program Files\Microsoft Dynamics NAV\90\  (As shown below)




Step - 1 : Copy the folder 90 in a new folder 90 – 48466 (As shown below)




Step - 2 : Copy all files from the Service folder, Which you will find in the Microsoft Dynamics Navision 2016 (9.00.48466) IN version setup folder (As shown below)

NAV.9.0.48466.IN CU 19.DVD\ServiceTier\program files\Microsoft Dynamics NAV\90\Service



Step -3 : Replace All the copied files into the Service folder on the given below path : (As shown below)

C:\Program Files\Microsoft Dynamics NAV\90 - 48466\Service

Note : Do not replace the files inside the base folder which was installed with setup.




Step – 4 : Open Windows PowerShell ISE (Run as Administrator) (As shown below)



Step - 5 : Run PowerShell command : (As shown below)

Set-ExecutionPolicy RemoteSigned

We will be running the script and by default, PowerShell stops running scripts. Run above command to set Execution Policy to Remote Signed.

Click on - Yes to ALL 



Step - 6 : Execute the following PowerShell CmdLet : (As shown below)

New-Service 'MicrosoftDynamicsNAVServer$Demo48466' -BinaryPathName '"C:\Program Files\Microsoft Dynamics NAV\90 - 48466\Service\Microsoft.Dynamics.Nav.Server.exe" $Demo48466 /config "C:\Program Files\Microsoft Dynamics NAV\90 - 48466\Service\Microsoft.Dynamics.NAV.Server.exe.config"' -DependsOn 'HTTP' -Description 'Service handling requests to Microsoft Dynamics NAV application.' -DisplayName 'Microsoft Dynamics NAV Server [Demo48466]' -StartupType Manual 

Note: you can replace Demo48466 with your preferred name 


As you can see in the given below image a new Service Instance has been created on Dynamics NAV 2016 Administration under the login account as SYSTEM.

Now all you have to do is just configure the Database Server, Database Instance & Database Name into Service Instance Configuration option.

Note : You may need to change the Ports of the  manually created Server Instance as it may conflict with other Service Instances already created on the machine.


*****In case of any error during the process, to delete/remove the created service use the following PowerShell CmdLet :

sc.exe delete 'MicrosoftDynamicsNAVServer$Demo48466' 

Note: don’t remove the instance using Microsoft Dynamics NAV 2016 Administration because, this is the Default instance for this build and it will removed the Service folder from the 90 - 48466 folder.


Hope you will find this post useful...
If any queries comment below.. 

STEP 3 - MSDYN365BC (Setup) - How to Setup Business Central

In the last articles in Step 1 & Step 2 of MSDYN365BC setup we installed dockers & Visual Studio Code for windows.
Next step is to download the Business Central Image using dockers and in future articles, we will start hacking or customizing Business Central.

If you are new to this series you can read old articles referring label MSDYN365BC.

Setup Business Central

Search and open Windows Powershell ISE as administrator.
Run command docker version to confirm that docker is installed and running.
If it's installed and running you will see an output as in below screenshot. If not then run the docker from the desktop shortcut or from the start menu.
Run command docker pull microsoft/bcsandbox:us to download the image for Business Central US version.
** This command running for the first time will take some time to download, don’t run it on a weak internet connection.
Using an object-oriented programming analogy, the difference between a Docker image and a Docker container is the same as that of the difference between a class and an object. An object is the runtime instance of a class. Similarly, a container is the runtime instance of an image.

Run PowerShell command –
Set-ExecutionPolicy RemoteSigned
We will be running the script and by default, PowerShell stops running scripts. Run above command to set Execution Policy to Remote Signed.
install-module navcontainerhelper -force
navcontainerhelper is a PowerShell Module, which can be installed from the PowerShell Gallery by using above cmdlet.
docker images
Above command will list down all the images that you have downloaded till now. If you have already run download image in the last section you should see one image as shown below.

docker container ls
Above command will list down all the containers which are running right now. As we don’t have any containers it will return blank.
New-NavContainer
For above command, please run using right-hand command panel and specify following parameters as per requirement.
A Sample command for New-NAVContainer is below –
           
New-NavContainer -containerName sauravMSDYNBC -accept_eula -alwaysPull -assignPremiumPlan -auth NavUserPassword -doNotExportObjectsToText -enableSymbolLoading -imageName microsoft/bcsandbox:us -includeCSide -memoryLimit 3G -shortcutsDesktop -updateHosts

Once you run above command, the system will prompt you to save your username & Password as encrypted.
** Remember your password.
** Password should fulfill password policy for SQL Server.

Once­ the PowerShell command is complete, a screen like below as result of PowerShell cmdlet.
Please keep a note of from above screen –
** These values will be used for using this container.
1      Container IP Address
2        Container Hostname
3        Container Dns Name
4        Web Client
5        Dev. Server
6        Dev. ServerInstance
7        Files

Check your desktop, you should have all shortcut icons that are require accessing Business Central Container.
Go ahead and use any of these + if you have SQL Server management studio installed, you can connect to SQL for Docker database.

** Remember as docker will start all containers will start automatically. Please remember to use docker container stop cmdlet to save the memory of your host machine.

If you are interested to load some old NAV version using docker you can refer following GitHub page.

Business Central (Github) : https://hub.docker.com/r/microsoft/bcsandbox/
Dynamics NAV    (Github) : https://hub.docker.com/r/microsoft/dynamics-nav/

Be Ready, with the setup of business central on your local system. we will be discussing AL Code and how we can customize Business Central.


Source : https://saurav-nav.blogspot.com/2018/06/msdyn365bc-setup-business-central.html

STEP 2 - MSDYN365BC (Setup) - How to Install Visual Studio Code

In the last article Step 1 of MSDYN365BC setup, we installed dockers for windows. Most of us know that for coding in Business Central on cloud version we will require to use Visual Studio Code.

We all know that is future, I will leave it to you if you plan to ignore it but that is a clear Roadmap for the product in future. Even Business Central on-prem will allow customizing using NAV Developer environment I think its time we change our mindset and start using Visual studio Code.

In this article, we will discuss installation of Visual Studio code that we will use in future articles to customize business central.


What is Visual Studio Code?

Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux, and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.


Is Visual Studio Code is a replacement of C/AL?

No, it's not the way we code in NAV from ages will remain as it is in VS code. I would even say that coding in VS Code will make life more simple with new features that are available.

Yes, it will change the way we used to code. It will not allow us to modify any base objects in any way. You can only see the Metadata of standard object but you cannot modify it.


How it will impact?

It will be hard as everyone of us will have to unlearn old way of customizing NAV and will need to learn the new way of doing things which is using events and subscriptions?

Event and subscriptions are available from NAV 2016 and have enhanced in last 3 version.


We heard a lot about extensions. Do we need to worry about it?

If you have used extension V1 which is in NAV 2016 you might have the bad experience with them. Forget all those experiences and see the new V2 Extension which is completely automated.

If you haven't used extensions (as developers) you don't need to worry about it. Its all automated.  If you want to focus/learn then spent your time and energy on Events and subscriptions.

Installation of Visual Studio Code- 

Visit - https://code.visualstudio.com/Download

Download the installer from the website, based on your operating system.

Double-click VSCodeSetup Installer to run the installer.

I would suggest - During Installation setup actions for windows (all) as shown below.


Ready to Hack Business Central on Dockers. Just one more configuration that we will discuss in next article and then we will talk business.


STEP 1 - MSDYN365BC (Setup) - How to Install Dockers

The first article in this series is about the installation of dockers for windows. I know there may be some questions about dockers and why a new technology or software with all these changes in Product.

I will try to answer most of these questions and we will also talk about installation of Dockers.


What is Dockers?

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.

Read More about dockers here -  Link - https://www.docker.com/what-docker

Is Docker is a Microsoft Product?

Docker is not a Microsoft product. It's an open source software. In October 2014, Microsoft announced the integration of the Docker engine into the next Windows Server release. Windows Containers was made available for Windows 10 and Windows Server 2016.

Why we need to install Docker?

Freedy from Microsoft has put great efforts in integrating NAV and MSDYN365BC with Dockers.

With respect to NAV, dockers can be used for the following version -
1. NAV 2016.
2. NAV 2017.
3. NAV 2018.

All cumulative updates released by Microsoft on following versions are also available on dockers.

Business Central (latest and greatest) releases is also available in dockers.

More Resources by Freedy - https://blogs.msdn.microsoft.com/freddyk/tag/nav-on-docker/

You can plan to use or not to use dockers but I personally feel it will be a cool tool in your toolbox to have multiple version and CU in one single environment which can be accessed turn on and off based on your requirements. I will be using dockers to configure and demo Business central.

Docker Installation - 

Navigate to https://store.docker.com/editions/community/docker-ce-desktop-windows

Download the installer from the website.


Double-click Docker for Windows Installer to run the installer.

In the configuration panel, please select “Use Windows containers instead of Linux containers.”


Installation completed confirmation message.



When the installation finishes, run docker from the desktop (if you selected Add shortcut to desktop).

The whale icon in the notification area indicates that Docker is running, and accessible from a terminal.

Be Ready with Dockers, we will be using in future articles. We have one more installation to be done to continue our journey towards Microsoft Dynamics 365 Business central. We will talk about it in future articles.


Source : https://saurav-nav.blogspot.com/2018/06/msdyn365bc-install-dockers.html

How to run a Table from the Navision windows client (Not the Development Environment)

Here is a small tip (some of you might already know it): the GETURL together with the HYPERLINK can be used to run objects in Navision (Even Tables 🙂).

I am working on a tool for a function to view the data in the tables, and for this I needed a way to run a table from the Navision windows client (Not the Development Environment). This turned out to be quite easy using the GETURL and HYPERLINK functions.

Here is an example of how it can be applied;

Given below record will consist of a list of tables where a user can check Records for the tables where all data is counted. To assist the user in determining what exactly is the data in a particular record we created a function to run the table to show the data will be in the ribbon of the page. The function will run the table of the line that is highlighted based on the Table ID field.

The code for this is as follows.
The GETURL is used to build the link to the table and the HYPERLINK is used to open the link.


Now when the user clicks View Records Dynamics NAV will open the table and show all records just like if the table was run from the Object Designer (Development Environment)

Nice isn’t it!? 🙂

Things to Know About Item Charges

The Item Charge functionality in Dynamics NAV gives you the option to include additional costs such as freight, insurance, fuel charges, etc. in the unit cost or unit price of an item transaction. Item Charges are something that most companies that handles any type of inventory would benefit from using. When implementing item charges there are a couple of things to be aware of :


Non-Inventoriable Costs
Item charges can be entered on a purchase invoice or purchase order and applied to an outbound transactions such as a sales shipment or a purchase return order. When doing this you get a non-inventoriable cost as a value entry. This does not create any g/l entries, the only place you see the affect of a non-inventoriable cost is in the statistics of an item and in the ‘Cost Amount (Non-Invtbl.)’ field on the item ledger entries.

Receiving / Shipping Item Charges
Item charges can be entered on a purchase or sales order. When receiving or shipping a line with an item charge you don’t get any transactions at all. There is no expected costs postings for item charges even if you turned this on the in inventory setup. This would have been very nice, but unfortunately it does not work like this. Something to wish for in future releases…

Item Charge Dimensions
Item charges creates value entries related to the item ledger entries of the shipment/receipt that is it applied to. Those value entries (and the related g/l entries) get dimensions according to the dimensions on the document line where the item charge is entered. This sometimes causes issues if you for example have an item charge that is applied towards multiple receipts that contains items with different default dimensions.

Users quite often setup the default dimensions on items with the ‘Value Posting’ equal to ‘Same Code’ because they want to prevent posting with other dimension values on the item. Doing this will also prevent posting the item charges with different dimension values that the one define as default on the items.

The recommended way to handle this is to setup the default dimensions on the items with the ‘Value Posting’ equal to ‘Code Mandatory’ and have a separate dimension values for the item charges, this way the item charges will always post and you can identify/separate them during reporting. Note: if you for example want to report the inventory value by the dimensions defined on the items then you can build your report based on the item ledger entries that contains the correct dimensions from the items and with the values including the item charges.

It would have been nice if the dimensions for the value entries created during posting an item charge would be retrieved from the related item ledger entry, but it does not work like this. Something to wish for in future releases…

Creating a Item with Inventory Value Zero in Navision

Dynamics Navision has an ‘Inventory Value Zero’ field in the item table that is not visible on the page (for some unknown reason).
Adding it to the page allows you to have items with no inventory values, this is useful if you managing inventory on the behalf of someone else or if you want to keep track of material that you have expended (like packaging materials, etc..).


An Item setup like this can be transacted like any other item in Dynamics NAV, except it can not be produced. If you try to enter a production order with an item flagged as ‘Inventory Value Zero’ you will get an error message saying ‘Inventory Value must be equal to ‘No’ in Item No. 'XXXX’ when you refresh the production order.

When purchasing an item  flagged as ‘Inventory Value Zero’ you will not get any inventory related transactions in the G/L, Only the Purchase transaction in the P&L and the AP transaction in the BS.

Microsoft Dynamics 365 Business Central

Microsoft Dynamics 365 Business Central is now official

Microsoft just released the new name for “Microsoft Dynamics 365 ‘Tenerife'”, where “Tenerife” was just a codename for the next version of “NAV-In-The-Cloud”. And as you might have figured from the title, that name is “Microsoft Dynamics 365 Business Central”

Generally available beginning April 2nd, Business Central offers businesses a single, end to end solution for managing finances, operations, sales and customer service, and an opportunity to easily upgrade from entry-level accounting software and legacy ERP systems.

Dynamics 365 Business Central will be generally available on April 2, 2018, in 14 countries – United States, Canada, United Kingdom, Denmark, Netherlands, Germany, Spain, Italy, France, Austria, Switzerland, Belgium, Sweden, and Finland, purchased through Cloud Solution Provider (CSP) partners.

Australia and New Zealand will be generally available beginning July 1, 2018.

Microsoft has given two interesting links for you to learn more about:

You can read more about this exciting news on clicking here.

How to Kill Sessions in Dynamics NAV 2013 & above

In the older versions of Microsoft Dynamics NAV where the classic client was available you could go to the sessions table and just delete a session to kill it. This was very useful for a number of reasons but it does not work like that anymore in the windows client of version 2013 and above.

Fortunately this feature can easily be replicated by adding an action item to the ribbon on the sessions page in Dynamics NAV.

Here is how you can add a ‘Kill Session’ action item to the sessions page:

Open page 9506 in design mode through the development environment and add a ‘Kill Session’ action item. Something like below.



Then write the following code to the action item.


The above text constant Text50000 just says ‘Kill Session?’.

To make the action item look a bit better you might also want to set the Image and Promotion properties, like below.


That’s it! 🙂

Now when you run the sessions table you can use the new ‘Kill Session’ action item in the ribbon to kill a session. Useful if a session is hanging or has been idle for a while. Also very useful if you start the job queue with a client and you want to stop the background session that is running.

Hope you find above post helpful...

Comment and Uncomment Selection in Navision

One of the small features in Microsoft Dynamics NAV is the ability to comment a selection of code.

Now I am not a huge believer in putting comments in code. Actually I am of the school that think comments are evil, because code should be written so it explains itself. That aside I find the new feature handy when testing and you want to take something out just for a test run.

How does it work?

If you are in the code you can mark a few lines of Code like this


Then click “Comment Seletion…” under the Edit Menu or use the shortcut Shift+Ctrl+K and the marked lines will be commented out by setting 2 forward slashes in front of the code at the left margin.


There is also an “Uncomment Seletion…” with the shortcut Shift+Ctrl+O that will remove the comments again.

Absolutely a help to developers, but please consider how you use comments.

Comments should not be needed in the final version of great code.