Showing posts with label NAV 2009. Show all posts
Showing posts with label NAV 2009. Show all posts

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

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”.

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

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.

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

Tuesday, March 23, 2010

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.

Wednesday, December 23, 2009

Transformation Tool Issue

There may be possibility in some forms to show the records in bold & colors based on the conditions.

CurrForm."No.".UPDATEFONTBOLD(Condition);

CurrForm."No.".UPDATEFORECOLOR(Condition);

While converting this form to page using Transformation Tool, we will face compilation errors in page because same code is moved into the pages.

After the R&D, I found CodeRules.txt in the Transformation Tool does not have proper rules to transform the above kind of code in to pages.

For Example:

For CurrForm.”No.”.ENABLED(Condition), it is working properly because of the following marked code rules.

  • <find>
  • !currForm!.!var1!.ENABLED :=
  • <declareVariable>
  • !var1!Enable
  • <declareVariableType>
  • Boolean INDATASET
  • <replace>
  • !declaredVariable! :=
  • <moveValueToProperty>
  • !declaredVariable!
  • <movePropertyToControlName>
  • !var1!
  • <moveToProperty>
  • Enabled
  • <comment>

But for Currform.”No.”.UPDATEFONTBOLD(Condition), it is not working because there are not code rules for <moveValueToProperty> <movePropertyToControlName> <moveToProperty>

  • <find>
  • IF !var1! <> !var1!::!var2! THEN
  •   !currForm!.!var3!.UPDATEFONTBOLD := TRUE;
  • <replace>
  • !currForm!.!var3!.UPDATEFONTBOLD := !var1! <> !var1!::!var2!;
  • <find>
  • !currForm!.!var1!.UPDATEFONTBOLD :=
  • <declareVariable>
  • !var1!Emphasize
  • <declareVariableType>
  • Boolean INDATASET
  • <replace>
  • !declaredVariable! :=
  • <comment>

Solution: Either we should change the code rules or modify the page manually.

Wednesday, December 16, 2009

New Report Properties in NAV 2009 SP1

Microsoft Dynamics NAV 2009 (Sp1) reports has new properties to utilize the advantages in the Visual Studio report designing.

Using the following properties, you can design the RTC reports with additional functionalities:

  • EnableHyperlinks (Useful for Drill Down from a Report to a Page functionality)
  • EnableExternalImages
  • EnableExternalAssemblies

Tuesday, December 15, 2009

Reporting for Microsoft Dynamics NAV 2009 (SP1)

Microsoft has provided a very good demo script with scenarios on how to use the new reporting functionality in Microsoft Dynamics NAV 2009.

This documents covers the following functionalities.

  • Format text and add colour
  • Interactively sort table data in a report
  • Add charts
  • Save a report as a PDF or an Excel file
  • Drill down from a report to a page
  • Please click the link to download the Demo Script from the Partner Source.

    Wednesday, December 9, 2009

    How to determine the add-in's public key token

    To register an add-in, you include it in the Client Add-in table in Microsoft Dynamics NAV. To include an add-in in the table, you must provide the Public Key Token.

    1. At a command prompt, change to the directory that contains the sn.exe utility.

    For example, the default directory for Microsoft Visual Studio 2008 is C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin. (or) the default directory for sn.ext file is C:\Program Files\Microsoft.NET\SDK\v2.0 64bit\Bin.

    2.   Type the following command:

           sn.exe –T <assembly>

    Replace <assembly> with the add-in assembly's path and file name, such as Program Files\Microsoft Dynamics NAV\60\RoleTailored Client\Add-ins\MyCompany.MyProduct.RtcAddins.dll

    3. Press ENTER and not the public token key that is displayed.

    NOTE: Please use semicolons before and after <assembly> value like the following: <assembly>

    Saturday, November 28, 2009

    How to block New, Edit and View actions in the ListPage

    In Microsoft Dynamics NAV RT Client, pages has default actions like New, Edit, View and etc…imageIn the ListPage, New action is promoted and shown in the New Promoted Category. This action is not promoted in the card part. 

    image According to my requirement, I do not want New promoted action in the listpage. This can be achived by customizing the Actions like the following:

    image image

    But this process should need to be done in every client. The same requirement can be achieved by modifying the TIF information.

    For Customer List Example: Remove the CardFormID field value in the TIF information for the Customer List and transform the page to form..

    image image image

    Limitations: Double clicking the Customer List will not open the Customer Card (Standard Functionality). Work around is to create a new action to open the Card and promote this action.

    image

    Sunday, November 8, 2009

    Object Subtype field in the AllObjWithCaption table

    In Microsoft Dynamics NAV, AllObjWithCaption table is one of the virtual table from the older versions.

    This AllObjWithCaption virtual table holds all the objects details like Type, ID, Name and Caption.

    One new field Object Subtype is added to this table in NAV 2009.

    image

    This field is used to store subtype of two object types. 1) Codeunits 2) Pages

    Codeunits has three Subtypes.

    1) Normal: These are normal coduenits.

    2) Test: Testing Codeunit

    3) TestRunner: Test runner codeunit, used to run the Test Codeunits.

    Pages has different subtypes like Card, List, Worksheet, Document, etc…

    Saturday, October 24, 2009

    How Run button in Object Designer opens the page in the RTC

    In the NAV 2009 SP1, it is possible to run the Page from the Object Designer.

    image In the Object Designer, Run button will open the related page in Role Tailored Client. I think this is achieved using the HYPERLINK function in Navision.

    HYPERLINK function passes a URL as an argument to an Internet browser.

    By adding the following code in OnPush Tirgger of any button will open the related page in Role Tailored Client.

    HYPERLINK('DynamicsNAV:////runpage?page=' + FORMAT(ID));

    Here ID valud should be Page ID.

    The above code can also be applied to open the reports in Role Tailored Client.

    HYPERLINK('DynamicsNAV:////runreport?report=' + FORMAT(ID));

    The above line of code can be added to any form/page to open the pages/reports dynamically.

    Friday, October 23, 2009

    Transformation Tool: Subfrom Menu Items to Pages

    Using Transformation Tool it is possible to transform forms to pages in NAV 2009.
    Forms like Sales Order, Purchase Order has Line Menu Button in the Main from and Transformation Tool automatically transforms the Line Menu button to the Sub page (ListPart). If the Menu Button has any Menu Items, Transformation Tool will also move the Menu Items to the Sub page.

    Logic behind this is,Transformation Tool moves the Menu Item to Sub page if it finds the code like “CurrForm.subform.FORM.FunctionName” in the Onpush of the menu item.
    Sales Order—>Line—>Reservation Entries, OnPush trigger has the following code.
    CurrForm.SalesLines.FORM.ShowReservationEntries;
    image

    For example if you want a confirmation message before opening the reservation entries, you can write the code in the function or you can write like below:
    IF CONFIRM(Text123,TRUE) THEN
      CurrForm.SalesLines.FORM.ShowReservationEntries;

    If the code is like above, Transformation Tool will not move this Reservation Entries menu item to sub page. It will create a new Line menu button in the main page and add the Reservation Entries menu item to that.
    image
    TIP: If your requirement needs to write code before calling the function in the subform, maintain the code in single line like the following:
    IF CONFIRM(Text123,TRUE) THEN CurrForm.SalesLines.FORM.ShowReservationEntries;