Friday, December 24, 2010

Locking and Unlocking Objects– Auto-Lock on Design

In Microsoft Dynamics NAV 2009 R2, you can lock an object in Object Designer using Lock option. Along with Lock we have other options like Unlock and Force Unlock.

Along with these features you can automatically lock an object while opening the object in design mode.

This option is available in the Tools->Options->Auto-Lock on Design.

image

Even though you can lock objects, it is still possible for developers to have concurrency issues, as shown in the following examples.

  • A developer opens an object in the designer but does not lock it. The developer makes several changes to the object and saves the changes periodically. At the same time, a second developer locks the object, and the first developer cannot save design changes to the object. The first developer gets an error message that the object is locked by the second developer.
  • A developer locks an object. A second developer opens the locked object in read-only mode, and then the first developer unlocks the object. The second developer still cannot save design changes to the object even though the object is now unlocked because it is open in read-only mode.

System Indicator–Dynamics NAV 2009 R2

Till now all NAV users including developers or end users felt little difficult to identify the different instances of NAV. Now we have a solution called system indicator in NAV 2009 R2 release to differentiate different instances like production environment and test environment.

Once you setup the system indicator in the company information, you can see the indicator text in the top right side of each page in the Role Tailored Client…Cool…Winking smile

image

image

NOTE: Refer GetSystemIndicator function in the Codeunit 1 ApplicationManagement.

Thursday, December 16, 2010

What’s New in Microsoft Dynamics NAV 2009 R2

MSDN is updated with the latest help related to NAV 2009 R2 Application updates and Developer updates.

Please click the link and get updated with the latest stuff.

Monday, December 13, 2010

Book Review–Microsoft Dynamics NAV 2009 Programming Cookbook

Intended Audience:

This book seems to more appropriate for people who already have experience with Dynamics NAV and may want to review or have a quick overview of the basics.

I believe that a person with some programming background can also use this as a quick jump start to be able to be able to work on Dynamics NAV.

Content/ Information:

The content of the book is appropriate as per the title. The author has given appropriate technical information to convince the reader. By appropriate information I mean to say that the only specific (more frequently used) information is provided with reference to standard Dynamics NAV coding (wherever necessary).

The sections “How it works” and “There is more”, are really helpful as they are short and to the point.

The author’s style of writing is more informal, without compromising the quality. I really appreciate this style, because I believe the intended audience of this book would rather like to quickly review or update themselves with the content rather than spend time on formal and lengthy notations.

Overall the style completely suits the intended audience.

How did the book affect me?

I really liked the book from Chapter 6 onwards. Because this book has touched the areas in Dynamics NAV which a developer would like to precisely go through. The topics covered under Chapter 6 to Chapter 12 are really interactive and at the same time some parts of it can be used like tips and tricks.

Usually these topics are not covered together and have to be search for and more over the explanations are too lengthy. I believe that these topics are very useful and can be quickly reviewed whenever required with less complexity.

How well the book has achieved its goal?

The book achieves its goal, to be a “cookbook” ! It is precise and to the point. So no complaints, but I would like to place some of my concerns especially in earlier chapters:

  • I would have liked if more functions and data types were covered in Chapter 1, as many a times it mentions us to refer to C/SIDE reference guide for other/ similar kind of functions/data types.
  • The book gives appropriate examples, but forgets to mention the syntax. Nothing major but I think it would help people (especially new to Dynamics NAV) more.

Overall the books do achieves its goal. Here is a quick link to this book.

Wednesday, December 8, 2010

Book Review - Microsoft Dynamics NAV Administration

This is a helpful book for the beginners to get good idea on the following concepts:
                Installing Dynamics NAV and its components.
                Securing Dynamics NAV applications.
                Backup and Restore options.
                Performance Tuning.
                Reporting Dynamics NAV.
But the major chapters explained here are more or less available in different formats like MSDN and other Microsoft standard materials.
It would be good if the book covers more on Application Virtualization.
Overall I see this book as a very good guide to learn install, configure, deploy and administer Dynamics NAV.

Monday, November 22, 2010

Why manually renaming a record takes little time?

In Dynamics NAV, if you try to modify the primary key field values it will take little time to change the value and also shows the window processing different tables.

When you try to change the primary key field value, internally it will check for the fields in all the tables which has the table relation to the primary key. That means system will check for the foreign keys related to the primary key and change the field value to the new value.

Pointing upLet’s say you have tables like sales header & sales line and if you want to reflect the primary key changes in the sales header to sales line, provide the table relations in the sales line.

rename

Wednesday, October 20, 2010

TEMPORARYPATH and APPLICATIONPATH Functions

TEMPORARYPATH: This function returns the path to the directory where the temporary file for Microsoft Dynamics NAV is stored.

This function returns the following path in the classic client:image

This function returns the following path In the RT client: image

APPLICATIONPATH:  This function returns the path to the directory where the executable file for Microsoft Dynamics NAV is installed.

This function return the following path in the classic client:image

This function return the following path in the RT client:image

Tuesday, September 21, 2010

CurrFieldNo

We all know that CurrFieldNo contains the field number of the current field in the current form.

Today I noticed that even though it contains the field number, by the time of executing table trigger (like OnModify or OnDelete), it contains zero (not the last modified field number).

Monday, July 26, 2010

Book Review - Microsoft Dynamics NAV 2009 Application Design

First of all, congrats and thanks to Mark Brummel for writing a fantastic book and sharing his knowledge in very straight forward manner. When I got a copy of this book, I was very eager to read this and after started reading, my interest also increased from chapter to chapter. I learned new points and recalled my knowledge while reading this book. Instead of explaining basics of NAV, he explained the core points which are important for every NAV professional.

Especially I liked the following points in his book:
  • ‘Look, Learn and Love’ principle is good.
  • He not only explained the functionality and also the history of the functionality. For Example: Manufacturing.
  • How different functionalities are used in various vertical industries.
  • Application Life cycle chapter is useful.
In my opinion, it would be good if the book also covers the following points:
  • Section for keys and indexes.
  • Application Test Toolset.
  • More details about the MRP and MPS.
Mistakes:
  • In the Page 33, it is given as “Flow filters can have seven types” but it is flow fields.
Overall this book is suggestible for every NAV professional.
You can order this book from packtpub.

Friday, July 23, 2010

IndentationColumnName and IndentationControls properties

IndentationColumnName and IndentationControls are the page properties in the NAV 2009. These properties are used to indent the controls or columns.

Transformation Tool will automatically convert the following type of code in the form and adjust the above two properties in the page to show the data as indented.

For Example: Form 18, CurrForm.Name.UPDATEINDENT := Indentation * 220;

Now the major problem in the pages is, you cannot use these properties for the fields that are editable and has a table relation.

For example, you cannot indent Item No. or Location Code in the Item Journal page because these fields are editable and has a relation with another table. If you try to indent these fields, while entering the data into these fields, field value is automatically updated with the first value.

If you press “1” in the Item No. field, it will be automatically filled with the first value starting with 1 like “1000”.

Thursday, July 15, 2010

Microsoft Dynamics® Regional Partner Awards - 2010

Microsoft announced the Microsoft Dynamics® Regional Partner Awards – 2010.

Here is the link to the press release.

Saturday, July 10, 2010

Microsoft Dynamics Inner Circle and President Club Members

Microsoft announced the  Microsoft Dynamics Inner Circle and President Club Members for the FY10.

Here is the link to the list of winners and Congrats to them.

Friday, June 25, 2010

Dynamics NAV Testing Framework - Create Handler Functions

Microsoft Dynamics NAV 2009 SP1 includes the following features to help you test your application:

  • Test codeunits

  • Test runner codeunits

  • UI handlers

  • ASSERTERROR statement

Application Test Toolset provided by Microsoft includes the Test Runner and sample Test Codeunits.

To create automated tests, you must write code to handle all UI interactions so that the tests do not require user interaction when running. To do this, you create the following special handler functions:

  • MessageHandler: Handles MESSAGE statements.
  • ConfirmHandler: Handles CONFIRM statements.
  • StrMenuHandler: Handles STRMENU statements.
  • FormHandler: Handles specific forms or pages that are not run modally.
  • ModalFormHandler: Handles specific forms or pages that are run modally.
  • ReportHandler: Handles specific reports.

In the following post, I included sample UI Handler Functions which can be used while creating test codeunits.

Signature: MessageHandler <Function name>(<Msg> : Text[1024])

Sample Code:

    [MessageHandler]
    PROCEDURE MessageHandler@1100499002(Msg@1100499000 : Text[150]);
    VAR
      Text001@1100499001 : TextConst 'ENU=Sales Order posted sucessfully.';
    BEGIN
      IF Msg <> Text001 THEN
        ERROR('Unknown Message');
    END;

 

Signature: ConfirmHandler <Function name>(<Question> : Text[1024]; VAR <Reply> : Boolean)

Sample Code:

    [ConfirmHandler]
    PROCEDURE ConfirmDialogYes@1102601013(Question@1102601000 : Text[1024];VAR Reply@1102601001 : Boolean);
    VAR
      Text001@1100499001 : TextConst 'ENU=Do you want to post the Sales Order?';
    BEGIN
      IF Question <> Text001 THEN
        ERROR('Unknown Confirm Text; %1',Question);
      Reply := TRUE;
    END;

 

Signature: StrMenuHandler <Function name>(<Options : Test[1024]; VAR <Choice> : Integer; <Instruction> : Text[1024])

Sample Code:

    [StrMenuHandler]
    PROCEDURE StrMenuHandler@1100499000(Options@1100499000 : Text[100];VAR Choice@1100499001 : Integer;Instruction@1100499002 : Text[100]);
    VAR
      Text000@1100499003 : TextConst 'ENU=&Ship,&Invoice,Ship &and Invoice';
    BEGIN
      IF Options = Text000 THEN
        Choice := 1;
    END;

 

Signature: FormHandler <Function name>(VAR <form name> : Form <form id>)

Sample Code:

    [FormHandler]
    PROCEDURE FormHandler@1100499001(VAR FormName@1100499000 : Form 21);
    BEGIN
      FormName.ActivateFields
    END;

 

Signature: ModalFormHandler <Function name>(VAR <form name> : Form <form id>; VAR <Response> : Action)

Sample Code:

    [ModalFormHandler]
    PROCEDURE ModalFormHandler@1100499002(VAR FormName@1100499000 : Form 342;VAR ReplyAction@1100499001 : Action);
    BEGIN
      ReplyAction := ACTION::LookupOK;
    END;

NOTE: UI Handler functions should be specified in the main test function as below.

image

Wednesday, June 2, 2010

Shortcuts in NAV 2009 (Special for List Page)

In NAV 2009 SP1, we all know that Ctrl+Shift+V is to open the page in View Mode, Ctrl+Shift+E is to open the page in Edit Mode.

Along with the above two shortcuts, we also have Ctrl+Shift+L to open the list page in View Mode, Ctrl+Shift+K is to open the list page in Edit Mode.

image But the second shortcuts (Ctrl+Shift+L, Ctrl+Shift+K) won’t work for all list pages. My learning today is, second shortcuts are only applied to the list pages which does not have a card page attached to it.

For Example: Payment Terms page which has no card page linked will show Ctrl+Shift+L and Ctrl+Shift+K.

imageFor Example:  Item List page which has card page (30) linked will show Ctrl+Shift+V and Ctrl+Shift+E.

image

Tuesday, June 1, 2010

Dynamics NAV Job Graphs

Job Graphs website provided graphical analytical interpretation of different aspect of Dynamics NAV…

Refer the link to find the details…

Monday, May 24, 2010

How to insert records into NAV from Visual Studio

Below is a simple console application to create a customer record from the visual studio.

namespace ConsoleApplication1
{
    using Customer;
    class Program
    {
        static void Main(string[] args)
        {
            Customer_Service service = new Customer_Service();
            service.UseDefaultCredentials = true;
            Customer.Customer customer = new Customer.Customer() { No = "123491", Blocked = Blocked.Ship};
            service.Create(ref customer);
        }   
    }
}

This will insert customer record but Blocked field does not contains the correct value. This can be achieved by changing the line as below:

Customer.Customer customer = new Customer.Customer() { No = "123491", Blocked = Blocked.Ship, BlockedSpecified = true};

This is mostly required for all fields except the string type because I think web services request/responses are in xml and type conversions are required internally from string to other data type.

Thursday, May 20, 2010

HideValue Property in NAV 2009 Pages

May be many of you are aware of the new field property “HideValue” for the Pages.

imageIf you set this property to TRUE, value in this field is not displayed in the Page. In the following scenario, I will explain how to automatically set this property to TRUE using the Transformation Tool, instead of changing the property value manually.

Let’s go to the customer card and go to OnFormat Trigger of the Name field. Adding one line of code will do the same functionality as HideValue property.

image Transform the form to page using the Transformation Tool and check the output in Role Tailored Client.

Form Output:image

Page Output:image

Wednesday, May 19, 2010

Microsoft Unveils New Functionality for Microsoft Dynamics NAV 2009

Microsoft unveils the new functionalities for Microsoft Dynamics NAV 2009. You can read the press release.

PRAGUE — May 19, 2010 — As part of Microsoft Corp.’s commitment to providing leading enterprise resource planning (ERP) solutions to midrange organizations worldwide, the company today unveiled Microsoft Dynamics NAV 2009 R2 at Directions EMEA 2010. Because of the investment in architecture for Microsoft Dynamics NAV 2009, customers are able to take advantage of the benefits of the software-plus-services vision through the R2 release more quickly than scheduled, including built-in integration with Microsoft Dynamics CRM and online Payment Service. Microsoft Dynamics NAV 2009 customers will benefit from the following:

Microsoft Dynamics CRM integration. Today’s fast-paced business environment demands instant access to customers and vendors. Microsoft is providing built-in integration with Microsoft Dynamics CRM. Benefits of customer relationship management (CRM) integration include eliminating redundant data entries, keeping information up to date in both ERP and CRM solutions, and providing salespeople with the ability to quickly access detailed business information about contracts, pricing and product availability. Customers can choose between integration to on-premises Microsoft Dynamics CRM or Microsoft Dynamics CRM Online with the option to migrate to either option over time.

Online Payment Service for Microsoft Dynamics NAV. This enables customers to process payment transactions from the Microsoft Dynamics NAV interface across multiple channels, including e-commerce, point of sale and call center transactions. The Payment Service works with leading payment processing services and all major credit cards.

RoleTailored interface access for remote or roaming users. Microsoft Dynamics NAV 2009 R2 supports direct access from the Microsoft Dynamics RoleTailored experience over the Internet. This allows for remote or roaming users to take advantage of the richness and Microsoft Office integration of the RoleTailored interface and the many integration features connected to local resources, such as the operating system and Microsoft Office. This reduces the complexity and overhead compared with using other applications such as Citrix Systems and Terminal Services, especially for hosting partners offering cloud-based Microsoft Dynamics NAV deployments.

Microsoft Application Virtualization support. The Microsoft Dynamics NAV 2009 R2 RoleTailored interface can be deployed using Microsoft Application Virtualization (App-V) technology, which is relevant for both on-premise and hosted solutions. This provides a better experience for the end user as all integration with local applications is done on the desktop. It also cuts IT costs by centrally managing Microsoft Dynamics NAV client installations with automatic deployment to the desktop after an update.

Windows 7 user experience improvements. Through Microsoft Dynamics NAV 2009 R2,jumplists can be used to open recently accessed customers and vendors for increased business productivity and efficiency, and the icon overlay functionality provides information on system events and status streamlined with the Windows 7 user experience.

Treemap visualization. Microsoft Dynamics NAV 2009 R2 showcases the possibilities around business data visualizations abilities in Microsoft Dynamics NAV through rich ad hoc data visualization. It provides treemap analysis that enables the comparison of any two values, for example sales and profits, which increases business productivity and business insight. The innovative client extensibility framework used allows partners to extend the user experience of Microsoft Dynamics NAV to integrate visualizations into any end-user scenario.

“We’re delivering this release in response to customer and partner feedback,” said Crispin Read, general manager of Microsoft Dynamics ERP at Microsoft. “Microsoft is committed to continuously bringing forth innovation in our ERP solutions, including the integration with cloud services. These latest enhancements to Microsoft Dynamics NAV 2009 are an important step in delivering solutions that drive real business productivity.”

“The new features in Microsoft Dynamics NAV 2009 R2 improve our business opportunities and benefit our customers. The fact that Microsoft is able to deliver faster than planned reaffirms our decision to build our solutions on Microsoft Dynamics NAV,” said Christian Sega, managing director at agiles Informationssysteme GmbH, an industry solution provider and consulting company specializing in horizontal workflow solutions built on Microsoft Dynamics NAV.

Microsoft Dynamics NAV 2009 R2 will be available in the fourth quarter of 2010.

Tuesday, May 11, 2010

Web Reference in Visual Studio

As specified in one of the help scenario, I created a codeunit with two functions in it and published that to the web services along with the customer card and named both as ‘PageWithCapitalization’.

image

imageWhen I try to create a web reference in the Visual Studio, as the two web services I published has same Service Name, the Page web reference also has the methods of the codeunit.

image

Monday, May 10, 2010

sp_$ndo$loginproc Login Stored Procedure on the SQL Server Option

A login stored procedure is a stored procedure that you can use to perform predefined functions after a user logs on to Microsoft Dynamics NAV with Microsoft SQL Server. A typical function would be to generate a message informing the user that the database is currently in single-user mode so that an administrator can perform database maintenance tasks and is therefore inaccessible.

The login stored procedure is run immediately after the user has logged on to SQL Server and opened a database and before Microsoft Dynamics NAV carries out any tasks including executing any C/AL triggers. The user must have successfully logged on to the server and have access to the database before the stored procedure is run.

Creating the Stored Procedure

The stored procedure is created in the database and has a predefined name and a list of parameters.

The stored procedure is called [sp_$ndo$loginproc] and has the following characteristics:

  • It takes two VARCHAR parameters: the name of the application and the C/SIDE version number. These parameters must be declared as part of the stored procedure but do not have to be used.

  • It can perform transactions. Microsoft Dynamics NAV uses a COMMIT to flush any outstanding transactions after the stored procedure has finished executing.

  • The RAISERROR statement can be used to display an error message in Microsoft Dynamics NAV and prevent the user from accessing the database.

  • The PRINT statement can be used to display a warning in Microsoft Dynamics NAV and allow the user to access the database.

  • If the stored procedure returns a value, it is ignored.

  • If the stored procedure does not exist, no action is taken by Microsoft Dynamics NAV and the login process continues as usual.

The following examples show how to create a login procedure in the Query Analyzer tool. The database must be selected before these statements are executed.

Example 1

The following code example displays a warning message in Microsoft Dynamics NAV and permits the login.

IF EXISTS (SELECT name FROM sysobjects
WHERE name = 'sp_$ndo$loginproc' AND type = 'P')
DROP PROCEDURE [sp_$ndo$loginproc]
GO
CREATE PROCEDURE [sp_$ndo$loginproc]
@appname VARCHAR(64) = NULL,
@appversion VARCHAR(16) = NULL
AS
BEGIN
PRINT 'The system will be unavailable on Sunday April 1.'
END
GO
GRANT EXECUTE ON [sp_$ndo$loginproc] TO public
GO

Example 2

The following code example displays an error message in Microsoft Dynamics NAV and prevents the login.

IF EXISTS (SELECT name FROM sysobjects
WHERE name = 'sp_$ndo$loginproc' AND type = 'P')
DROP PROCEDURE [sp_$ndo$loginproc]
GO
CREATE PROCEDURE [sp_$ndo$loginproc]
@appname VARCHAR(64) = NULL,
@appversion VARCHAR(16) = NULL
AS
BEGIN
IF SUSER_SNAME() IN ('ACCOUNTS\jim', 'SALES\bill')
RAISERROR ('Contact the system administrator.', 11, 1)
END
GO
GRANT EXECUTE ON [sp_$ndo$loginproc] TO public
GO

Sunday, May 9, 2010

What makes Expert - Matt.Traxinger

Today I read the following post from Mr. Matt.Traxinger and really impressed with it…

The what is not nearly as important as the why.
Obviously the most important part of being an expert is understanding what you're doing. Don't get that confused with knowing what you're doing. Just because you can perform the lab exercises in the functional and technical manuals with your eyes closed doesn't mean you're an expert. Knowing how to run Adjust Cost, even knowing what it does, is not the same as understanding why it needs to be run.

It's not what you know, it's who you know
If you know what every button, every object, and every line of code in the system does then congratulations. You should either be billing 2000 hours a year and making a six-figure salary or running your own solution center. It's important to remember that in an application as big as NAV you're never going to know it all. Even Microsoft MVPs and senior level professionals have questions sometimes. That's not to say that you shouldn't strive to learn as much as possible, but you should have a place, or better yet, specific people that you can bounce questions off of. Speaking from experience, it's not easy to learn when you don't have anyone to help you. If you need a place to start, I highly recommendwww.mibuso.com.

Love what you do
I've developed in my fair share of languages: Basic, C, C++, Java, Jython, C#, SmallTalk, Lisp, just to list the more well known ones. I've built windows applications, web sites, all sorts of things. I have to say, though, that I absolutely love being an ERP developer. If I spent my days writing OS and device driver code I would go insane. Whenever people ask me what I do, it's basically a conversation ender: Computer Programmer (I boil it down to a term they should be familiar with). Little do they know they're missing out on so much fun. I can't imagine doing anything different. If you don't feel the same way about what you do, then you should find something you do love. Don't spend your time trying to become an expert in something you don't want to do.

Transferability
If you can't put the things you know into words (that includes speaking, writing, coding, and anything else that involves knowledge transfer) then you cannot be considered an expert. The purpose of becoming an expert is not just to hoard everything you've learned, but to turn that knowledge into practical, useful tools. More importantly, your knowledge should be used to make other more knowledgeable. Think back to when you were the junior developer, wanting to succeed, but not knowing where to start. The ability to help others will only make you more successful.

Friday, April 23, 2010

MSDN Feedback

Till now I know that, there is an option in MSDN to give feedback but I never used it before.

Today I also came to know the details about the MSDN Feedback, especially for Microsoft Dynamics NAV blog.

Click the link to know the details about it.

Sunday, April 18, 2010

DataCaptionFields and DataCaptionExpr property

This is a simple and known work around to set the form/page caption. This is particularly useful if you want to set an option field as form caption because changing the DataCaptionFields property won't work in the form and page.

In the following example scenario, I will include "Document Type" into the caption of the sales order form. This can be achieved by simply creating a function and changing the DataCaptionExpr property.

  • Create a function.

image

  • Add the following code in the function.

image

  • Change the DataCaptionExpr property as below:

image

  • Run the Sales Order and see the ouput.image

Saturday, March 27, 2010

Tuesday, March 23, 2010

Wednesday, March 17, 2010

How to close the main form immediately after closing the sub form

Here is the standard NAV example to close the main form immediately after closing the sub form.

1) Open the Form 5784 from the Object Designer.

2) Click the Modify button to open the “Source Document Filter Card” from the ‘Filters to Get Source Docs.’ form.

3) Close the “Source Document Filter Card”. This will close the main form “Filters to Get Source Docs.” as well.

You can close the form conditionally, using the following set of example code in the ‘Run’ button.

GetSourceBatch.USEREQUESTFORM(ShowRequestForm);
GetSourceBatch.RUNMODAL;
IF GetSourceBatch.NotCancelled THEN
  CurrForm.CLOSE;

Friday, January 29, 2010

Calculated field on a page is only recalculated when the OnValidation trigger is run

A page will only update a field if it detects that there is some code on the OnValidate trigger. This is done for performance reasons to avoid unnecessary updates.

Please click the link to read the complete story from the Microsoft Dynamics NAV Team Blog.

Friday, January 22, 2010

ERP_Data Philosophy

Even though I have good knowledge on different aspects of ERP, today I noticed a very good data philosophy in the David Studebaker book related to ERP.

“Enter once, use everywhere”