Dynamics NAV

Thursday, 15 January 2015

What's New in Microsoft Dynamics Reports in NAV 2015

In previous versions of Microsoft Dynamics NAV, you could only design the layout of reports by using Visual Studio

Report Designer or Microsoft SQL Server Report Builder. With Microsoft Dynamics NAV 2015, you can design
report layouts by using Microsoft Word 2013. Word report layouts are built on Word custom XML parts that 
dynamically map a report dataset into a report at runtime.

Customizing and Managing Report Layouts from the Microsoft Dynamics NAV Clients

You can customize Word and RDLC report layouts from the Microsoft Dynamics NAV Windows client and Microsoft 
Dynamics NAV Web client by using Word 2013 and SQL Server Report Builder, respectively. This enables users can
make variations of layouts, and then use the variations when viewing and printing reports as needed.

There are the  following new report functions have been added in Microsoft Dynamics NAV 2015 to support new report 
layout implementation.

SAVEASXML:                  Saves a report as an .xml file on the computer that is running Microsoft Dynamics NAV Server.
WORDXMLPART:            Returns the report data structure as structured XML that is compatible with Word Custom XML parts.
WORDLAYOUT:               Gets the Word report layout that is used on a report and returns it as a data stream.
RDLCLAYOUT:                Gets the RDLC layout that is used on a report and returns it as a data stream.
HASCUSTOMLAYOUT:    A function in codeunit 1 that determines whether a report has an active custom Word layout or RDLC layout at run time.
MERGEDOCUMENT:        A function in codeunit 1 that loads the custom Word layout that is active on report and renders it in the targeted format, such as Word, PDF.
REPORTGETCUSTOMRDLC : A function in codeunit 1 that loads the proper custom RDLC layout for a report at run time and uses the layout to render the report.


We can design the Layout in Word































Output will be shown below


How to Identify Client Type from C/AL Code

The following Microsoft Dynamics NAV clients interact with the Microsoft Dynamics NAV database through Microsoft Dynamics NAV Server:

  • Microsoft Dynamics NAV Windows client
  • Microsoft Dynamics NAV Web client 

If we have to differentiate development for Windows Client and Web Client then how to identify the client from 
c/AL code?

We have 2 functions available in Codeunit 419 - File Management called IsWindowsClient and IsWebClient.



Wednesday, 14 January 2015

How to send Documents as Email in NAV2015

 We have an option for sending attachments as email is available from Microsoft Dynamics NAV2015. 
We can see in sales invoices, sales credit memos, sales orders, sales quotes, reminders, and finance charge memos, as well as some posted documents. 

The option is available in the ribbon and called Email or Post and email depending on the context. 
It displays a dialog that lets you attach the document together with a short message and send this as email directly from Microsoft Dynamics NAV. 

In Microsoft Dynamics NAV Windows client you can decide to modify the email more in your default mail program. 
The default email sender address is based on the settings in the SMTP Mail Setup window. 
If SMTP is not configured or Outlook is not available, the .pdf file will open instead.

How to Stop Negative Inventory in NAV2013 R2

In earlier versions we have to customize NAV to achieve this but NAV2013R2 brings this feature as standard.


We can set up that outbound posting that brings inventory below zero is blocked. 
This can be set up per item or for all items. 

This setup is in the Inventory Setup, we can put a check mark in Prevent Negative Inventory field
 which specifies if you can post transactions that will bring inventory levels below zero.

The selection that you make in this field indicates the value in the Prevent Negative Inventory 
field on individual item cards. The values will either be Default (Yes) or Default (No)
which you can change.

I know have setup this for all Items i.e., in Inventory Setup and when I try to post an Item which has
 in sufficient Inventory then I got below error.

Microsoft Dynamics NAV
---------------------------
You have insufficient quantity of Item 1000 on inventory.
---------------------------
OK
---------------------------




One or more filters are not valid and will be ignored Message in NAVISION RTC

Today I tried to run (Preview) a Report with Date Filter and I got below confirmation message


Microsoft Dynamics NAV
---------------------------
One or more filters are not valid and will be ignored. Do you want to continue?
---------------------------
No   Yes
---------------------------




























Then I found that this is because of Wrong date format entered in Birth Date filter.
Date format in My system is set to DDMMYY and I entered as MMDDYY.

But this behavior is different in Classic Client (NAV2009R2).

I tried to enter same MMDDYY format in classic client Birth Date filed.

But It gives an error message as shown below
---------------------------
Microsoft Dynamics NAV Classic
---------------------------
'013150' is not a valid date.
---------------------------
OK 
---------------------------



How to Update/Modify Data in All Companies in the current database

We have Table 2000000006 – Company,which contains the list of companies exists in the database.
And also we have CHANGECOMPANY Function

Redirects references to table data from one company to another.

[Ok :=] Record.CHANGECOMPANY([CompanyName])
We can create a ProcessingOnly report to update the data in all companies using above table and function.
Ex: If I have to Update "Allow Posting From" and "Allow Posting To" field of General Ledger Setup table in all companies then:
1. Create a Processing Only report with Company as dataitem
2. write below code in Company - OnAfterGetRecord() trigger
   
GLSetup.CHANGECOMPANY(Name);

GLSetup.MODIFYALL("Allow Posting From",010213D);
GLSetup.MODIFYALL("Allow Posting To",280213D);

//You can use variables in Request Form for From Date and To Date




Here GLSetup is global variable of record type variable with General Ledger Setup table.

How to Disable Personalization in NAV2013 RTC

In general to Customize/Personalize NAV2013 RTC, 

"Choose Column" and "Customize This Page" as shown below 





But we can stop disable these Custimizations/Personalizations using a setup in NAV2013 RTC

Go to Profiles page as below
CRONUS /Departments/Administration/Application Setup/RoleTailored Client/Profiles

Select Profile for which you want to disable personalization
Click on Edit
Set TRUE in "Disable Personalization Field".

Close RTC and Reopen

Now the above options are not available you have a look in the below screenshot for your reference.