Wednesday, August 12, 2015

Color Theme for NAVISION

colour-pencils-450621_1920

 

Color plays a very vital role in our lives, can’t imagine life without colors. Every human being has their own favorite color and few colors soothe and some irritate your eyes. In today’s technology the visual experience color adds to all the daily software is very important and that may be the reason I recently saw many queries regarding this in Microsoft community forum to know if there is a way  to change the theme for the Navision. Unfortunately the answer is NO. The default theme Navision has i.e. light blue and white cannot be changed but in this blog I would like to share couple of tips which may interest you and may help to identify the things easily.

If you have several companies and different databases it is not easy to identify in which database or company you are logged in if you don’t use the below feature

System Indicator

This is the setting which you can use on the company information card, to identify database, company name and also you can give different colors. The System Indicatory Type has options Standard, Accent1 ….. Accent9, this setting sets the color for the heading which shows on the application, For example with below setting my system indicator shows in green color
image
image
Please refer to the below link for more detailed information
https://msdn.microsoft.com/en-us/library/Gg502461.aspx

Style
On the Navision Page each field has a property called Style and StyleExpr, these settings can be used to add color to the value of the field.

 image
 
 
The Style property has 7 different options Standard, StandardAccent, Strong, StrongAccent, Attention, AttentionAccent, and Favorable

image
 
We don’t have many color options but atleast it is different than standard black.
 
You can set the property directly with one of the options or you can add code to set this value to the StyleExpr property based on certain conditions.

For example on Customer Card for the Credit Limit (LCY) field the StyleExpr is set to StyleTxt which is variable of type text but the value to that variable is assigned in a function like below
IF CalcAvailableCredit < 0 THEN
EXIT('Unfavorable');
EXIT('');

If you assign value directly to the Style property, in below example I assigned Attention to the Style for the Name field on the customer card page

image
I am hoping Microsoft might add theme options in one of the future release, you can also provide your idea at the following website www.ilovenav.com
Share:

The Type of Flowfield in the table must be decimal

 

It is always challenging to resolve an error, when the error message is unclear or misleading.  Today I encountered same kind of message while I was making a modification to the table. 

 

error-63628_1280

I had a Normal custom date field in one of the table , i had also added some logic for validating the field and populating it on certain conditions. But today the requirement has changed and the user wants to convert that field to a Flowfield and to lookup  to another field in a different table. We have some test data in the database where custom date field is populated in initial testing, so the first task when you change type of the field, if you have the data in that field, is to clear/delete the data from all the companies.  Second task is to find the places where you assigned the value for the field and comment/delete it.

After completing the above two tasks I started testing the change and I received the below error

“The type of flowfield xxxx in the xxxx table must be decimal”

The first thing that occurred to me was the “CalcFormulae” might be looking at wrong field so I verified it and everything was fine there, so I compiled all the related tables and pages to check again but I was still getting the error.

I ran the debugger and it is breaking at a line of code where it is trying to validate the field, it is not assigning any value just validating

VALIDATE('xxxxxx');



Once I commented the code, it worked fine. Interesting huh.. I tried with other field type text as flowfield and I got same error message, I tried with decimal field it gave me similar kind of error message.


I understand you cannot validate a flowfield but the error message it is throwing is totally misleading, I am not sure but I believe this is a bug.


If you encounter above message please do check if both tables have same data type and if there is any code to validate the field.

Share:

Friday, February 20, 2015

How to change Page Title BAR Caption

I have been asked this question couple of times, so I thought I would write a small blog about this.

On every page it displays some information about the selected record, for example in the below screenshot on the customer card it displays customer no. and name, can we control what to display on this title bar or left of the caption on page? and the answer to the question is yes. if so how?

image

On the table there is a property called “DataCaptionFields” which controls what to display in the title bar. So in this example if I check customer table the DataCaptionFields is set to No.,Name. So let me change that to display the City, now my DataCaptionFields is set to No.,Name,City and after the change it is displaying  the city in the title bar. So anytime you want to change the caption use this property and I think this is a very useful property because it is easy to find the right  information on the title bar and instead of looking over all the tabs on the page.

My Suggestion is to limit to use to 2-4 fields on this property.

image

But wait a minute there is a same property on the page, so when is that used ? According to Microsoft help the DataCaptionFields property on the table is used for card pages and if nothing is defined primary key is used. The value on the page is ignored for card pages.

For tabular pages:

Tabular pages show multiple records at a time. The following data caption rules are applied:

A data caption is only displayed if a filter containing the fields defined in the DataCaptionFields property for the page evaluate to one value. In this case, two situations are possible:

There is a table relation (as defined by the TableRelation Property) on one or more of the fields. In this case, the DataCaptionFields from the underlying table are used. If this table does not have a value for the DataCaptionFields property, the primary key for that table is used.

There is no table relation. In this case, the (single) value that results from evaluating the filter is used directly

 

There is also an example in the help, so please refer to that to know when Page DataCaptionFields will work.

If you have any questions or suggestions please leave a comment.

Share:

Application Profiler/CODE COVERAGE in Navision 2013 R2

In the previous versions of Navision we use to have code coverage which is used to trace C/AL Code and the developers used to have the ability to scan the piece of code which is executed during an action,process. This tool was very helpful in debugging. Even in Navision 2013 Microsoft shipped Application tool set which includes code coverage tool but in later version we don’t have this option.

In this blog I try to explain the options we have for Navision 2013 R2.  The tool which is available for Navision 2013 R2 is Application profiler and which can be downloaded from the following link

http://navappprofiler.codeplex.com/

The downloaded file has DLLs and few objects in .txt format. It also has readme file which will guide you through the easy install process.  Rename the objects numbers if you already used them.

In order to run the code coverage run the Page 50000/ Performance Profiler

image

In order to trace the C/AL code for an action, please select the session you want to execute the trace for from the Target Session ID and click Start.

After executing the actions click stop. In the below example I executed the post action for the sales order.

The data it collects is combination of SQL Statements and C/AL code as shown in the below figure.

image

In order to view only the C/AL code try to set the filter for the object ID <> 0 and you will see all the C/AL statements it executed for the action. You can view all the code and analyze it from the result set.

I have not tested this on 2015 but I believe it will work on it. When I get sometime I will test it on NAV2015 and post the results.

Please leave your questions and suggestions in the comment section.

Share:

Tuesday, December 30, 2014

Conditional Page break in RTC Reports

In this post I will try to explain how to dynamically control the page break for a group or in other words how to create a conditional page break in the NAV 2013 RTC report.

For this post I will use the standard report 5057 (Salesperson – To-do’s), this report is already grouped by salesperson but now we will add the option to page break (New Page per Salesperson).

1. Open report 5057 in design mode and declare a new global variable NewPagePerSalesPerson (Boolean) which we will use in the request page

clip_image002

2. Now we will add the option in the request page of the report for the user to choose page break, for that choose View à Request Page and add the variable as show in the below fig.

clip_image004

3. Add the variable NewPagePerSalesPerson to the report dataset and name it as PageBreakPerSalesPerson.

clip_image006

4. Now open the report in layout mode by choosing View à Layout, notice the report already has a group which is grouped on Salesperson field

clip_image008

Currently this group is not enabled for page breaks, but if you enable page break it will use new page per salesperson every time you run the report but we want to control that based on the value in the options window.

clip_image010

5. To enable page break based on the value in the options windows of the report, add a new a outmost group for the current group by right clicking on the Table1_Group and Choose Add Group à Parent Group

clip_image012

In Group Window open the expression editor by clicking Fx and leave other properties to their defaults

clip_image014

Add the following expression

=IIF(Fields!PageBreakPerSalesPerson.Value,Fields!To_do__Salesperson_Code_.Value,Nothing)

clip_image016

Click OK.

6. A new column is added to the table select the column and delete the column, and from the confirmation dialog choose Delete Columns only.

clip_image018

clip_image020

7. From the newly added group, right click and select Group properties

clip_image022

In the Page Breaks, select Between each instance of a group.

clip_image024

Now if you run the report with option selected New Page Per Salesperson it will create a page break for every salesperson.

clip_image026

clip_image028

There are some other standard reports like 108 - Customer - Order Detail, which has similar options and logic but instead of using an expression for a group it uses a variable value.

Please leave your comments, feedback or any suggestions you have for me to improve me my blog and also if you have any questions, feel free to post .

Share:

Friday, December 20, 2013

Restore error while restoring company in the database: Navision

Restore error while restoring a company in the database

image



Make sure when you connect to the Navision the database name is same, i.e.  case sensitive.  In my case i have shortcut which was using DEV as database name but the actual database name was Dev. So i reconnected again using Dev and choose Tools –> Restore and this time it completed without an error.
Share:

Thursday, December 19, 2013

Restore failed Operating system returned the error 5 (Access denied)

I was trying to restore a database using SQL 2012 management studio but when I click ok after selecting file I was getting below error

clip_image002

Cause:

By default the database and log files are creating in MSSQL10_50.MSSQLServer folder.

image

Resolution:

Check the Relocation all files to folder  in the above fig. so that it will create files in MSSQL.11.NAVDEMO folder

Share:

Wednesday, December 18, 2013

Saturday, September 29, 2012

"The date is not valid" in Navision 2009 SP1 or R2

Today I got a request in which the client was getting "the date is not valid" error when they are trying to authorize credit card using Navision Webservice. They were using chargelogic add-on and exposed a codeunit in which it has functions to authorize credit card.


When I first saw that error my initial thought was it is something related to settings in customsettings. config file. So we changed "WebServicesDefaultTimeZone” setting to use "Server Time Zone". But unfortunately that did not fix the issue and we kept getting the same error. Then I used my debugging skills to find the part of code where the error was happening. Once I debugged it I found that they have some customizations to improve performance in which one of them was to use single instance codeunit to get data from setup tables. Instead of using normal statement table.GET statement they stored all these get statements in separate functions in a single instance codeunit and they called this codeunit whenever they wanted to use GET statement for setup tables.

Share:

Saturday, July 7, 2012

The Page contains a control add-in that is not permitted.

You may notice this error, when you develop a client add-in and add that to a page but forget to register the client add-in.



In Navision whenever you develop a client add-in you need to register that in Client Add-in” table (2000000069) with at least its name and the public key token of its signature. You can do this manually if you know the public key token and here is the msdn article to get the key for add-in.

Share:

Wednesday, July 4, 2012

An Error has occurred while logging on to the MAPI session - Navision


The other day i was helping a client to move their customizations from classic to Role Tailored Client. They had a custom email functionality which was working fine but when the function was executed in Role Tailored Client Navision 2009 R2 it did not open outlook client. When i debugged i found that error was happening at the below line of code which is in custom codeunit which was implemented by previous VAR.

IF (NOT OApplication.Logon(TRUE,'','',FALSE,FALSE)) THEN BEGIN
  OApplication.Logoff;
  EXIT
END;

 
Then i added Message Box to display OApplication.ErrorDescripton which showed the below error message.


I googled for this error but could not find much help, so i executed standard email function on customer communication and it was working. Then i compared custom function and the standard email function in codeunit 397 for new message. I found one difference, when an object is created using CREATE the custom email function was not using NewServer and OnClient parameter.

For example custom code has : CREATE(OApplication) which will work fine in classic, but to execute this on RTC we need to use NewServer and OnClient paramters.

So i have changed code from CREATE(OApplication) to CREATE(OApplication,TRUE,TRUE) and did this same for other objects. This resolved the issue.


Share:

Tuesday, June 12, 2012

Data migration error %1 is not a supported datatype


When you design a dataport and if you have used a field which is of flowfield type and when you try to import data using that dataport, you will be see the below error message.

"%1 is not a supported datatype"

To reslove this error please remove the flowfields from field designer of dataport.
Share: