• Microsoft Dynamics NAV Team Blog

    Using Web Services to Access Microsoft Dynamics NAV 5.0

    • 49 Comments

    Introduction

    Dynamics NAV 2009 contains a new subsystem for dealing with Web Services. This feature has been well received by partners and customers alike. Partners have expressed interest in having web services available for earlier versions of Dynamics NAV. This feedback resulted in a technology talk at Directions2007 in Florida, where the topic was what could be done to day. The conclusion of the talk was that everything we where intending to deliver was already possible today, yes some code is needed but strictly from function/feature perspective all of it is possible, and it is not even all that ugly. Dynamics NAV 2009 will provide out-of-the-box programmatic web service access to the application and will therefore remove the need for this additional technology plumbing described here.

    I have to say that the response to my talk has been tremendous. After the response to my talk on Web Services in NAV 5.0 and previous versions I decided to write this blog post and make the source files available.

    This post is about how to bridge the gap between the need for web services now and the current platform, it will help you understand how you can provide Web Services directly from Dynamics NAV today, in a “simple” and flexible way, already today.

    To work with the samples in this post you will need: Visual Studio 2005, Dynamics NAV 5.0 and .Net 3.0 installed on your system. This sample should work on Dynamics NAV 4.0 to but has not been tested on that version.

    Architecture

    The system we will build contains 4 different components/moving parts: Web Service Listener, Event Dispatcher, Codeunit Eventhandler and XMLPort for stream handling.

    image

    Web Service Consumer

    Any client that understands how to communicate with Web Services; like InfoPath, Visual Studio, SharePoint or any custom application written by you.

    Port

    Is the physical communication port that the WCF listens to.

    WCF Web Service

    Defines the data contracts and service contracts for the Web Service, it also implements the concrete service and opens for listening in the WCF subsystem, it then delegates the requests to the COM Event Dispatcher component.

    COM Event Dispatcher

    This component provides the hookups for Dynamics NAV, both to activate the service and to register event sinks. It defines 2 IDispatch interfaces the IServiceEvents and the IWebServiceListner, as well as the concrete implementation of the IWebServiceListner in the WebServiceListner class that provides the actual code for hooking up the WCF Web Service to Dynamics NAV.

    .NET

    We are using the CLR runtime for writing our Web Service component and our COM plugin. Some of this blog entry is about interop between Dynamics NAV and .NET through COM.

    Codeunit Event Handler

    Is responsible for starting up the WCF Web Service through the COM interface, it then registered for events coming from the WCF Web Service Component. The events routed to XMLPort for processing.

    XMLPorts for datastreams

    It deals with the actual business logic and data coming from or going to the Web Service.

    Implementation

    The implementation is in 2 programming languages: C# and C/AL.

    Please take a look at the provided code sample, for the rest of the information contained in the posting. It can be found here: http://code.msdn.microsoft.com/nav/Release/ProjectReleases.aspx?ReleaseId=896

    I have included comments in the code that should explain what is going on, if you feel something is missing, first look at the documentation for the WCF or post a comment to this post and I will try to answer it.

    Deployment of Sample

    To deploy the sample you will first have to download it, unpack it.

    Then open it up with Visual Studio and compile.

    Then import the codeunit.txt and xmlport.txt into your NAV installation and compile those objects, starting with the XMLPort

    To run the service simply open the Object Designer in NAV, find the Codeunit that you just imported and press run.

    There is no dependency on IIS or other external components. No further deployment steps should be needed.

    In the Visual studio solution is a ConsoleTestApp project. After you have followed the steps above you can run that project, it will test if your install was successful, as well as provide sample on how to use the web service.

    Special considerations

    In this sample I’m using XMLPort to handle the XML stream that is provided.

    You can take many different approaches to this, and still reuse large please of the code provided in the sample.

    To use the XMLPort as handler you will have to set the encoding property to UTF-8. This is due to a null termination bug in stream handler in NAV.

    image

    image

    With this approach you can already today, incorporate web services in your projects in straightforward way.

    The appropriate usage is whenever you need to give external application access to Dynamics NAV data or business process.

    For any questions or comments please feel free to ask them in the comment section of this blog post.  I will answer questions to best of my ability on this post in the comments section as well.

    One last thing:  This is a sample code.  It has not been tested, you should thoroughly test this code before usage.

    Best regards,
    Kris Rafnsson

  • Microsoft Dynamics NAV Team Blog

    Microsoft Dynamics NAV/SQL Server Configuration Recommendations

    • 12 Comments

    Michael De Voe, a Senior Premier Field Engineer at Microsoft, has compiled a set of recommendations for SQL Server configuration to improve performance when running Microsoft Dynamics NAV 5.0 and later versions with one of the following versions of SQL Server:

    • Microsoft SQL Server 2005 SP3 x64
    • Microsoft SQL Server 2008 SP1 x64
    • Microsoft SQL Server 2008 R2 x64

     The attached document contains Michael's recommendations, including the following options and parameters:

    • Max Server Memory
    • Auto-Create Statistics
    • Auto-Update Statistics
    • Auto-Grow
    • Database Compatibility Level
    • Trace Flag 4136
    • Trace Flag 4119
    • Data files for TempDB
    • Disk Alignment
    • Read Committed Snapshot Isolation (RCSI)
    • Max Degree of Parallelism
    • Dynamics NAV Default Isolation Level
    • Dynamics NAV "Lock Timeout"
    • Dynamics NAV "Always Rowlock"
    • Maintenance Jobs
    • Instant File Initialization
    • Optimize for Ad Hoc Workloads
    • Page Verify
    • Lock Pages in Memory

     These postings are provided "AS IS" with no warranties and confers no rights. You assume all risk for your use.

  • Microsoft Dynamics NAV Team Blog

    Visual Studio 2010 and SSRS (RDLC) reports in NAV 2009

    • 5 Comments

    A couple of weeks ago Microsoft Visual Studio 2010 was released. Unfortunately we will not be able to support Visual Studio 2010 in Dynamics NAV 2009 when developing SSRS (RDLC) reports.

    When you are designing RDLC reports in NAV 2009 you are creating reports in a format known as the “RDL 2005” format.
    Both Visual Studio 2005 and 2008 supports this format, but not Visual Studio 2010. Visual Studio 2010 is able to open the “RDL 2005” format but will immediately convert the report to “RDL 2008” format. This conversion gives us the some challenges:

    1. To view an “RDL 2008” format report you will need to have to have the “Microsoft Report Viewer 2010” installed on all Role Tailored client (RTC) machines, currently the “Microsoft Report Viewer 2008” is installed by the NAV 2009 installation program.
    2. If we opened up for Visual Studio 2010 you will convert the reports you design to “RDL 2008” format, and leave the unopened reports in “RDL 2005” format. So i.e. are developing an add on and share this with other partners you will need to inform these partners that Report Viewer 2010 is a requirement for all RTC machines. And if these partners are to modify any of your reports, Visual Studio 2010 is a requirement as well.
    3. We need change our code to now compile to “RDL 2008” format when importing the RDLC layout back to NAV.

    So to avoid this confusion we will not open up for Visual Studio 2010 support before our next major version of Dynamics NAV.

    If you for other reasons want to use Visual Studio 2010 you can easily have Visual Studio 2008 and Visual Studio 2010 installed on the same machine. We will just open the Visual Studio 2008 version when you select “View / Layout” in the Object Designer.

    If you only have Visual Studio 2010 installed you will see this message:

    An error occurred when opening Report Designer. A supported version of Visual Studio could not be found.

    This is the same message you get when you have no Visual Studio installed, because we search for the following Visual Studio versions and in prioritized order. So in case you have both Visual Studio 2005 and 2008 installed, we will use the 2008 version:

    1. Microsoft Visual Studio 2008
    2. Microsoft Visual Web Developer 2008 Express edition with SP1.
    3. Microsoft Visual Studio 2005 with SP1
    4. Microsoft Visual Web Developer 2005 Express edition with SP1.

    In a previous blog post I outlined the Visual Studio options you have for designing RDLC reports for NAV 2009, and this list is still valid.

    Hint: If you are using Windows 7 and want to use “Microsoft SQL Server 2008 Express with Advanced Services ” you need to install “Microsoft SQL Server 2008 R2 Express with Advanced Services” to have a successful installation.

    Thanks,

    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Creating a web service manually, the importance of the name you give it, and a few small things to remember

    • 14 Comments

    When you use the SC command line command to create a new NAV 2009 Service, how does the new service know whether it is a middle tier for RTC to connect to, or whether it is supposed to handle web service calls?

    In other words, what decides whether the new service will be "Microsoft Dynamics NAV Server" or "Microsoft Dynamics NAV Business Web Services"?

     

    It depends on the name. If it starts with "MicrosoftDynamicsNavWS", then it will be for Web Services. If the name starts with anything else, then it will be for middle tier for RTC clients.

     

    To keep things simple, just give your NAV Servers names beginning with MicrosoftDynamicsNAV / MicrosoftDynamicsNAVWS. Then if you need a second, third, etc server, add a unique name, seperated by a $-sign, for example:

    MicrosoftDynamicsNAV$Svr2

    MicrosoftDynamicsNAVWS$Svr2

     

    Here are the simple steps for how to create a new web service service, and a few more things to be aware of. Let's say that we want to start a second set of NAV Servers.

     

    First create the normal service from a command prompt:

    SC CREATE "MicrosoftDynamicsNAV$Svr2" binpath= "C:\Program Files\Microsoft Dynamics NAV\60\Service2\Microsoft.Dynamics.Nav.Server.exe" DisplayName= "MSSvr2"

    Then create the service for Web Services: 

    SC CREATE "MicrosoftDynamicsNAVWS$Svr2" binpath= "C:\Program Files\Microsoft Dynamics NAV\60\Service2\Microsoft.Dynamics.Nav.Server.exe $Svr2" DisplayName= "MSWSSvr2" type= share

     

    The additional settings you must provide as marked in bold above, and a few things that you must remember are:

     

    1)  The Name

    As described, the name must begin with MicrosoftDynamicsNAVWS if you want it to be for web services

     

    2)  Include the last part of the name in BinPath

    After the .exe in the binpath parameter you must specify the part of the name ($Svr2 in this case) that comes after MicrosoftDynamicsNAVWS. If you forget this step, you might get this error when you try to start the service:

    Windows could not start the MSWSSvr2 service on Local Computer.Error 1083: The executable program that this service is configured to run in does not implement the service.


     

    3)  Type must be share

    For the service that handles web services, add the parameter type= share. Otherwise the service will still try to start up as a middle tier (not for web services).

     

    4)  Spaces after =

    You must remember the space after each = in the command, as in for example "type= share". This is just the syntax of the SC-command.

     

    5)  DisplayName

    It doesn't matter what display name you give - this is just to find it in Services.

     

    These are just some of the small things to keep in mind. For many more details on web services go to Freddys blog, especially this post:

    Multiple Service Tiers - SP1

     

    // Lars Lohndorf-Larsen

     

  • Microsoft Dynamics NAV Team Blog

    Send email with PDF attachment in NAV 2009

    • 13 Comments

    In this post I would like to explore the possibilities to create an email from the Role Tailored client and attach an invoice as a PDF file to the email, unfortunately we have do not have this functional build into our Demo application, but let me show you how this can be do with little effort.

    First I suggest you download the fob file which contains the 5 different options I will go through here.

    When downloaded the fob file you will see that I have added 5 new actions

    image

    1. SendAsPDF(Use of codeunit to rename) recommended solution
    2. SendAsPDF(Access to Server needed)
    3. SendAsPDF(With Temp file name)
    4. SendAsPDF(User prompted to save)
    5. SaveAsPDFrecommended solution(if you just want the PDF file)

    Let me go through the different options starting from the bottom, since I recommend option 1, but I would also like to share other options for doing this, since these might be valuable for you.

    Option 5: SaveAsPDF
    In this option you will get prompted if you want to open or save the PDF. The PDF file created will be based on the select Invoice in the Posted Sales Invoices List Place

    image 

    In this option all I do is to have the server create the PDF file for me and use the new download function in NAV 2009 to retrieve the PDF file created on the server.

    Option 4: SendAsPDF(User prompted to save)
    In this option, you will first be prompted to save the file.
    Here it is important to select to “”SAVE” the PDF file on the disk, to have the correct name of the PDF file. If you select to “OPEN” the PDF filename will be given a temp name.

    After you have saved the PDF we now create the email message you will get 3 messages similar to this when this happens:

    image

    You get these message because we connect to an external component(Outlook) to the Role Tailored client. It is of course up to you if you want to set this to “Always allow”, but this would remove these messages, the next time you open the Role Tailored client.

    When you have allowed these to run, email will be created with the PDF file attached.

    image

    In this option all I do is to download the PDF to the client and then use the Mail codeunit to create the email

    Option 3: SendAsPDF(With Temp file name)
    In this option, you will not be prompted to save the PDF file.
    And the email will be created immediately. This would probably be the preferred compared to downloading this to the user disk, but we will use the PDF file created on the server, and since this file get a TEMP name, like this: “__TEMP__570eb0279b9d4b1fa837caf3a14acbf7” this option is not really good.

    Let us look at the option 1 and 2 where this issue is solved.

    Option 2: SendAsPDF(Access to Server needed)
    In this option you will not be prompted to save the file either, but here the end user will need to have access the server folder where the PDF is stored on the server. In some situation you might want this, but for security reasons you might also not want to give this access to the user.

    Option 1: SendAsPDF(Use of codeunit to rename) recommended solution
    Again in this option you will not be prompted to save the PDF file, but the PDF file will be automatically added to the email. In this option we have build a codeunit to rename the TEMP file created on the server, and end user will not need to have access to any folders on the server.

    So all in all I recommend option 1 for attaching PDF file to an email. And once again I have made all the code available here, so feel to be explore how I build this. If you feel there is an option that I missed, feel free to leave a commit or use the contact form Email.

    Thanks,
    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Upgrade Toolkit for Upgrading Data from Microsoft Dynamics NAV 2009 R2 and Microsoft Dynamics NAV 2009 SP1 to Microsoft Dynamics NAV 2013 R2

    • 49 Comments

    The components needed to upgrade data directly from Microsoft Dynamics NAV 2009 R2 to Microsoft Dynamics NAV 2013 R2 are now available for download.

    Download the upgrade toolkit from PartnerSource or from CustomerSource

    In order to use the toolkit to upgrade data from Microsoft Dynamics 2009 R2 or Microsoft Dynamics NAV 2009 SP1, you will also need the Microsoft Dynamics NAV 2013 development environment and Microsoft Dynamics NAV 2013 R2.

    At the Directions EMEA conference in Vienna and the Directions US conference in Nashville, we said that we have a team that is focusing on the Microsoft Dynamics NAV upgrade story. Going through the big transformation from the classic stack to the new product architecture in Microsoft Dynamics NAV 2009 was not easy and is challenging many customers and partners. So for our team, it is essential that the final outcome of our work is that each upgrade is easier, requires significantly less effort, and that it does not disrupt the daily business for our customers.

    In Microsoft Dynamics NAV 2013 R2, we introduced support for converting a Microsoft Dynamics NAV 2013 database so that you can run an application that was created in Microsoft Dynamics NAV 2013 on the Microsoft Dynamics NAV 2013 R2 platform, also known as a technical upgrade.

    Note: We strongly recommend that you upgrade the application objects as well so that your solution includes the important application fixes and new functionality that is introduced in Microsoft Dynamics NAV 2013 R2.

    Secondly, you can fully automate the data upgrade process using the Windows PowerShell scripts that we included in the Microsoft Dynamics NAV 2013 R2 product media. Historically, this process has been known for its tediousness and high risk of human error when multiple operations had to be executed consecutively in all companies of the database that you were upgrading. The scripts automate this work so that you can test and execute your data upgrades more reliably.

    Now with this delivery, we introduce an upgrade toolkit for upgrading the data from Microsoft Dynamics NAV 2009 R2 to Microsoft Dynamics NAV 2013 R2. This significantly simplifies the upgrade process for those of you coming from Microsoft Dynamics NAV 2009 R2 – or Microsoft Dynamics NAV 2009 SP1.

    Included in the new upgrade toolkit are all known data upgrade-related application hotfixes that we are aware of, and we also addressed several platform issues that affected the upgrade scenario.

    Note: You must download the latest Microsoft Dynamics NAV platform hotfixes before you start using the upgrade toolkit. The required hotfixes for Microsoft Dynamics NAV 2013 are available in the latest hotfix rollup, which you can download from PartnerSource or CustomerSource. For Microsoft Dynamics NAV 2013 R2, you can download the required hotfixes from PartnerSource or CustomerSource.

    When you download the new upgrade toolkit from the link above, you can use it to simply your upgrade process. Here are the main steps in upgrading from Microsoft Dynamics NAV 2009 R2 (or Microsoft Dynamics NAV 2009 SP1) by using the new upgrade toolkit.

    Note

    Before you start, make sure that you use the latest platform binaries for all versions of Microsoft Dynamics NAV in this process. For more information, see the following pages for the latest updates to the versions of Microsoft Dynamics NAV:

    Microsoft Dynamics NAV 2009 R2: Overview of Released Platform Hotfixes for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2.

    Microsoft Dynamics NAV 2013: Released Cumulative Updates for Microsoft Dynamics NAV 2013.

    Microsoft Dynamics NAV 2013 R2: Released Cumulative Updates for Microsoft Dynamics NAV 2013 R2.

    To upgrade data from a Microsoft Dynamics NAV 2009 R2 or Microsoft Dynamics NAV 2009 SP1 database

    1. In the Microsoft Dynamics NAV  2009 R2 or Microsoft Dynamics NAV  2009 SP1 development environment (Classic client):
      1. Make sure that all table objects have compiled successfully. During compilation, Microsoft Dynamics NAV generates or regenerates the BLOB content in the Object Metadata table that is used in the later steps.  In the Tools menu, choose Build Server Application Objects.
        Note: You must also do this if you upgrade from Microsoft Dynamics NAV 2013 to Microsoft Dynamics NAV 2013 R2 . All tables must be compiled Microsoft Dynamics in NAV 2013 before you start upgrading to Microsoft Dynamics NAV 2013 R2.
      2. Create a copy or a backup of your old Microsoft Dynamics NAV 2009 R2 database, and open it in the Microsoft Dynamics NAV 2009 R2 development environment.
      3. Add your partner license to the database.
        You can do this by selecting the Save License in Database field in the Alter Database window. If the field was not already selected, a dialog box opens so you can specify the location of your partner license.
        If the field was already selected, upload the partner license from the License Information window.
      4. Open the Object Designer, and then import Upgrade601701.1.fob. If the .fob file contains objects with conflicting versions that are already in the database, the Import Worksheet window opens. Choose Replace All.
      5. For each company in the database, open the company, and make the relevant changes to data. For more information, see Task 3: Data/Object Changes Prior to Step 1 in the MSDN Library.
    2. Then, from the Object Designer, run form 104001, Upgrade - Old Version. Choose the Transfer Data button. Repeat this action for each company in the database. 
      Note
      We strongly recommend that you back up the database using SQL Server management tools after this step. 
    3. When you have transferred all data for all companies, in the Upgrade - Old Version window, choose the Delete Objects button.
      This action deletes all objects in the database that are not tables, but also obsolete tables that belong to functionality that is not available in Microsoft Dynamics NAV 2013 R2.
    4. Uninstall Microsoft Dynamics NAV 2009 R2, and then install Microsoft Dynamics NAV 2013.
      Note
      You do not have to install the full Microsoft Dynamics NAV 2013 product to perform the following database conversion. Instead, you can create a folder with the following files from the Microsoft Dynamics NAV 2013 product media:
      • Finsql.exe
      • Fin.stx
      • Fin.etx
      • CRONUS.FLF
      • Ndbcs.dll

      You can then use the Finsql.exe file to perform the conversion.  

    5. Change the compatibility level of your database. For SQL Server 2008 and SQL Server 2008 R2, verify that the compatibility level of the database is set to 100. For SQL Server 2012, set the compatibility level to 110.
    6. In the Microsoft Dynamics NAV 2013 development environment, open the Microsoft Dynamics NAV 2009 R2 database and agree to convert the database. The database has now been technically upgraded to Microsoft Dynamics NAV 2013.

      Note 
      During this step, Microsoft Dynamics NAV converts all text and code fields to Unicode format by changing their SQL Server data type. This conversion requires more disk space than usual, since both the database and the log file will grow in size considerably. It can also be a lengthy process.

      If your Microsoft Dynamics NAV 2009 R2 database is using SQL Server Collation, within the same step the collation will be changed to a suitable Windows collation. This is because Microsoft Dynamics NAV 2013 and higher versions only support Windows Collation. If you converted your database using the RTM version of Microsoft Dynamics NAV 2013, you may be experiencing collation-related issues after this conversion. Therefore it is strongly recommended to use the latest available version of Microsoft Dynamics NAV 2013 development environment to perform this step.

      Note
      We strongly recommend that you take a full SQL Server backup at this stage when the database conversion has completed.

    7. Uninstall Microsoft Dynamics NAV 2013, and then install Microsoft Dynamics NAV 2013 R2.
    8. In the Microsoft Dynamics NAV 2013 R2 development environment:
      1. Open the Microsoft Dynamics NAV 2013 database and agree to convert the database.
      2. Compile the system tables. You can find the tables by setting a filter for table ID 2000000004..2000000130.
        In the following step, you will be connecting a Microsoft Dynamics NAV Server instance to the database. 
    9. Make sure that the service account that the Microsoft Dynamics NAV Server instance uses has the db_owner role for the database. 

      Note 
      If you are upgrading a large database, such as a database size of more than 20-25 GB, make sure that you increase the timeout value in the Microsoft Dynamics NAV Server configuration file. In the CustomSettings.config file, the value is defined in the SQL Command Timeout node. The default value is 10 minutes, which is sufficient in the normal day-to-day work. However, during an upgrade that can take several hours depending on the size of the tables, you must increase the timeout period.

    10. Connect the Microsoft Dynamics NAV Server instance to the database, and then start the service instance.
    11. In the Microsoft Dynamics NAV 2013 R2 development environment:
      1. On the Tools menu, open Options, and then, make sure that the Prevent data loss from table changes field is set to Yes.You must also make sure that the Server Name, Server Instance, and Server Port fields are filled in.
        This ensures that the Microsoft Dynamics NAV Server instance that is connected to the database will verify that no operation will cause loss of data in the development environment.
      2. Import all customized objects in .fob format into the upgraded database. If the .fob file contains objects with conflicting versions that are already in the database, the Import Worksheet window opens. Choose Replace All.
      3. Make sure all objects are compiled.

        Important
        It is very important that at least all table objects have successfully compiled before you proceed.

      4. Import Upgrade Step 2 objects from the Upgrade601701.2.fob file.If the .fob file contains objects with conflicting versions that are already in the database, the Import Worksheet window opens. Choose Replace All.
    12. Perform the database schema synchronization by running the Sync-NAVTenant Windows PowerShell cmdlet in the Microsoft Dynamics NAV 2013 R2 Administration Shell (run as administrator).

      Note
      When you upgrade from one version to another, this typically involves numerous changes in the structure of the Microsoft Dynamics NAV tables (the object metadata). Database synchronization ensures that these changes in the metadata are applied to the corresponding tables in SQL Server. For example, it changes columns dimensions and data types, drops and create indices, drops and creates indexed views (V-SIFT), creates new tables, columns, and so on.

      When the number of changes is high, such as comparing Microsoft Dynamics NAV 2009 R2 to Microsoft Dynamics NAV 2013 R2, this synchronization can become a lengthy and resource consuming task.

      Database synchronization is triggered upon any request to Microsoft Dynamics NAV Server, such as when you start a client or run a windows Powershell cmdlet. Microsoft Dynamics NAV Server checks if metadata has changed since the last synchronization by comparing the content of the Object Metadata and Object Metadata Snapshot system tables. If a change is found, the synchronization procedure is initiated.  

      When the synchronization process has started, it is essential that you wait for it to complete or rollback (in case of an error or time-out). If you’re running a client, do not confirm or click anything client side. If you’re running the Sync-NAVTenant cmdlet, wait for it to complete and return control to the Windows PowerShell command prompt.

      Do NOT stop the Microsoft Dynamics NAV Server service at this point since there are high chances that the database synchronization transaction is still running.

      1. Run Microsoft Dynamics NAV 2013 R2 Administration Shell as Administrator. This opens a PowerShell prompt where the Microsoft Dynamics NAV cmdlets are available.

      2. Run the synchronization command against your upgrade database as follows: 

        Sync-NAVTenant –ServerInstance <MyNAVServerInstance> 

      3. Wait until the cmdlet returns control to the Windows PowerShell window.

    13. Open the Microsoft Dynamics NAV 2013 R2 Windows client to verify that you are connected to the Microsoft Dynamics NAV Server instance that is connected to the database being upgraded. 
      Next, you will run Upgrade Step 2 in each company in the upgraded database. You can get a list of all existing companies in the database by running the Get-NAVCompany cmdlet and passing as an argument the Microsoft Dynamics NAV Server instance which is connected to the upgraded database. 
      You will run objects directly from the development environment, so you must specify the company that the objects must run in in the Options window.
    14. In the Microsoft Dynamics NAV 2013 R2 development environment:
      1. On the Tools menu, open Options, and then, in the Company field, specify the name of the first company.
      2. In the Object Designer, find page 104002 Upgrade - New Version, and then choose Run.
      3. In the Upgrade - New Version window, choose Test Database Connection to make sure that the C/AL code that is triggered by the actions on the page has access to the database.
        If your database is on a named SQL Server instance, you must specify the full name in the SQL Server Name field.  
      4. Choose Transfer Data.
        If the process is successful, and you don't have to revisit the upgrade logs, you can clean the content of the Upgrade Time Log  table. 
      5. On the Navigate tab, choose Time Log, and then, in the Upgrade Time Log page, delete all records.
      6. Close the Upgrade - New Version window, and then close the Microsoft Dynamics NAV Windows client.
    15. Repeat step 14 for each remaining company in the database.
    16. When you have successfully transferred data in the last company, you must upgrade data that is common to all companies in the database, such as permissions, permission sets, web services, profiles and control add-ins.
    17. Upgrade data common to all companies such as permissions, permission sets, web services, profiles and control add-ins.
      If the customer has changed the Read/Write/Modify/Delete/Execute settings for any of the standard permissions, or customized default permission sets in any way, you must merge these changes into the default permissions sets and permissions that are included in Microsoft Dynamics NAV 2013 R2. You can use XMLport 104001 Import/Export Roles and XMLport 104002 Import/Export Permissions to export the new default roles and permissions from the CRONUS International Ltd. demonstration database in Microsoft Dynamics NAV 2013 R2. You can add control add-ins in the Control Add-ins window in the Microsoft Dynamics NAV Windows client. For more information, see How to: Register a Windows Client Control Add-in. For example, the following client control add-ins are available from the Microsoft Dynamics NAV 2013 R2 product media:
      • Microsoft.Dynamics.Nav.Client.BusinessChart
      • Microsoft.Dynamics.Nav.Client.PageReady
      • Microsoft.Dynamics.Nav.Client.PingPong
      • Microsoft.Dynamics.Nav.Client.VideoPlayer
    18. Delete the upgrade toolkit objects.
      1. In the Upgrade - New Version window, choose Mark/Delete Upgrade Toolkit.
        This deletes all upgrade toolkit objects, except tables
      2. In the Microsoft Dynamics NAV development environment, delete the upgrade tables by setting a field filter for objects where the Version List contains Upgrade Toolkit Table - marked for deletion.

    The database has now been through a data upgrade to Microsoft Dynamics NAV 2013 R2.

    Best regards,

    The Microsoft Dynamics NAV Service Experience team

    -----Blog post updated in May 2014-----

     

  • Microsoft Dynamics NAV Team Blog

    Using XMLports With Web Services

    • 10 Comments

    As a follow-up on my recent webcast (found HERE), here is the general walkthrough of how to create an XMLport and use it for sending data to NAV.

    First, what we want to do is create our XMLport and make sure it has the elements and values that we want.

    XMLPort

    For the root element, I have set maxOccurs = 1 to avoid any confusion.
    For the general XMLport, the UseDefaultNamespace and the DefaultNamespace values have been edited as seen below.

    SS02

    Other than that, I have no code on my XMLport, but naturally, anything goes that would work on a regular XMLport. Now to the Codeunit:


    ImportDim(VAR DimImport : XMLport DimImport) Return : Text[30]
    DimImport.IMPORT;
    EXIT('Import Run');

    So basically we’re telling the XMLport to run an import and we’re returning to the Web Service that we’ve run. All we need to do now is expose the Web Service using Form 810:

    SS03

    Remember that the actual name of the codeunit does not have to match that of the service name here.

    So now we move over to Visual Studio and start working with what we have. The first thing we’ll notice is that the WSDL matches our XMLport.

    SS04

    What we see is both the RootDimensions element which consists of multiple Dimension elements. From there, we can see the definition of the Dimension element the fields we’ve chosen to expose.

    When creating a new project, we will go with a Windows Forms project this time.

    SS05

    And from there we will start off by adding a web reference to http://localhost:7047/DynamicsNAV/WS/Codeunit/DimensionImport .

    The details on how to add a web reference can be found in the Developer and IT Pro Documentation.

    On my new form, I have created two input boxes for the Code and Name of the dimension and a Create button.

    SS06

    And then we have the code on the Create button, along with helpful comments:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms; 

    namespace
    NAV2009SP1WSDemo

        using WSDI; 
        public partial class Form1 : Form 
        {    

     

     

     

            public Form1() 
           
                InitializeComponent(); 
           
     
            private void button1_Click(object sender, EventArgs e) 
           
                //Make sure the ResultLabel doesn't have any text on multiple runs 
                ResultLabel.Text = ""

               
    //Create a WS reference instance, set credentials and define the company by specifying the URL. 
                DimensionImport NAVImport = new DimensionImport(); 
                NAVImport.UseDefaultCredentials = true
                NAVImport.Url = "http://localhost:7047/DynamicsNAV/WS/CRONUS%20International%20Ltd/Codeunit/DimensionImport"
                
                //First we create our root element 
                RootDimensions RootDim = new RootDimensions();

     

     

     

                //Then we create a List to handle our (possible) multiple dimensions 
                List<Dimension> DimList = new List<Dimension>();

     

     

     

                //And then we create a single dimension 
                Dimension Dim = new Dimension();  

     

                if (dimInputCode.Text != "" && dimInputName.Text != ""
               
                    //We assign the values from our textboxes to the single dimension 
                    Dim.DimensionCode = "AREA"
                    Dim.Code = dimInputCode.Text; 
                    Dim.Name = dimInputName.Text;

     

     

     

                    //Then we add the single dimension to our list 
                    DimList.Add(Dim);  

     

                    //To get the list of dimensions "attached" to the root element, we use the following
                    RootDim.Dimension = DimList.ToArray(); 
                    try 
                   
                        //Then we send to NAV and show our result 
                        ResultLabel.Text = NAVImport.ImportDim(ref RootDim);

     

     

     

                   
                    catch (Exception ex) 
                   
                        //Show a possible exception 
                        ResultLabel.Text = ex.ToString(); 
                   
               
                else 
               
                    //Make sure there are values 
                    ResultLabel.Text = "Both values must be filled"
               
            
        }
    }

    Our wonderful application is now ready to run and all we have to do is press F5:

    SS07

    We have now created our XMLport, exposed it using a codeunit and set data into it from a form based application.

    Lars Thomsen

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    Error 1935 when installing Dynamics NAV 5.0 SP1

    • 4 Comments

    When I tried to install the NAV 5.0 SP1 client I ran into an error 1935. This may happen on Vista and Windows 2008.

    Error 1935; an error occurred during the installation of
    assembly component {98CB24AD-52FB-DB5F-A01F-C8B3B9A1E18E}. HRESULT:0×800736CC.

    The solution is simpler then it seems. You need to install Microsoft Visual C++ 20005 SP1 Redistributable pack. Remember if you are running on a 64 bit system you need to install both x86 and x64 package.

    x86
    x64

  • Microsoft Dynamics NAV Team Blog

    Updated: How to log report usage

    • 27 Comments

    Updated: Now with links to both NAV 5.0 and NAV 2009 hotfixes

     /Claus Lundstrøm

    ******

    In several partners meetings I have heard this requests over and over again.

    Claus, when we are planning an upgrade of Classic reports to RDLC reports, we do not always know which reports are actually being used at the customer site. It would be great to be able to log which reports are used so we know exactly which reports we need to upgrade to RDLC.

    Well, if you download below hotfix you will now have the capability to log report usage at a customer site.

    Dynamics NAV 5.0: KB2575296

    Dynamics NAV 2009: KB2558650
    Find links to all NAV 2009 Platform Hotfixes here:
    CustomerSource: Overview of Released Platform Hotfixes for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2
    PartnerSource: Platform Hotfixes for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2

     

    In the following steps I have outlined which steps you need to do to get this log file. Remember above hotfix is required to perform the following steps.

    1. Create new table to be used for Log report usage:

    clip_image002

    OBJECT Table 50000 Report Log
    {
    OBJECT-PROPERTIES
    {
    Date=22-06-11;
    Time=14:19:58;
    Modified=Yes;
    Version List=CLAUSL;
    }
    PROPERTIES
    {
    }
    FIELDS
    {
    { 1 ; ;No. ;Integer ;AutoIncrement=Yes;
    MinValue=1 }
    { 2 ; ;User ID ;Code50 ;TableRelation="User Role"."Role ID";
    CaptionML=ENU=User ID }
    { 3 ; ;Report ID ;Integer ;CaptionML=ENU=Report ID }
    { 4 ; ;Report Name ;Text249 ;FieldClass=FlowField;
    CalcFormula=Lookup(AllObjWithCaption."Object Caption" WHERE (Object Type=CONST(Report),
    Object ID=FIELD(Report ID)));
    CaptionML=ENU=Report Name }
    { 5 ; ;Date Time ;DateTime }
    }
    KEYS
    {
    { ;No. ;Clustered=Yes }
    }
    FIELDGROUPS
    {
    }
    CODE
    {
    BEGIN
    END.
    }
    }

    2. Now with the table created for our Report Usage log please open Codeunit 1

    3. Open “C/AL Globals”

    4. Navigate to ”Functions”

    clip_image004

    5. Create new function with Name=”OnReportRun”

    clip_image006

    6. Open Properties and change ID to 120

    clip_image008

    7. Now open “Locals” and create parameter= ReportId with Type=Integer

    clip_image010

    8. Select Variables tab and create ReportLog

    clip_image012

    9. Now all we need is to write the code for this new trigger. Open C/AL Editor and navigate to the end.

    10. In OnReportRun write the following code:

    ReportLog."User ID" := USERID;

    ReportLog."Report ID" := ReportId;

    ReportLog."Date Time" := CURRENTDATETIME;

    ReportLog.INSERT;

    clip_image014

    11. Now Restart Classic Client

    12. Run a couple of reports

    13. And then at last run the Report Log table to see the result:

    clip_image016

    Yes I’m aware that this solution only works for Classic Reports, and yes I also would like a feature so it’s possible for you to log all objects being used at a customer site. For now we do not get this, but let’s see what the future brings.

    /Claus Lundstrøm

  • Microsoft Dynamics NAV Team Blog

    Transfooter and Transheader functionality in RDLC(SSRS) reports - revisited

    • 8 Comments

    In one of our previous blog post we discussed the possibility to do Transfooter and Transheader functionality in RDLC(SSRS) reports and describes a viable solution for this in RDLC.

    In this blog post we would like to suggest an alternative, a bit more economical and easier to implement solution for the same problem.

    For the demo we use the same table and the same report and will strive to achieve the same results as in the mentioned in our previous blog post.

    1. Create new report blank report with table 18

    clip_image002

    2. Create DataItem ”Customer”

    3. Go to Section Designer and add the following fields:

    • No.
    • Name
    • Debit Amount

    4. Save the report as ID 50000 – Transfooter / Transheader

    5. Now go to Visual Studio (View / Layout)

    6. Create table and add the fields No, Name and Debit Amount

    7. Give this table the name "MainTable"

    8. Now we have added the basic for this report. But I would also like to have a Grand total of the Debit Amount so I add this as well. I add this in the Footer of the table

    ="GrandTotal: " & sum(Fields!Customer__Debit_Amount_.Value)

    image

    9. Now if my report is printed I get a list of my all my customer with Debit Amount displayed and with GrandTotal in the end of the report:

    10. Now I create a small block of VBS code in order to perform some calculations and store intermediate data

    Open “Report->Report Properties” dialog and select “Code” tab, enter the following VBS code:

    11. Define a hashtable for storing running accumulated sums for each page of the report

    Shared RunningTotals As New System.Collections.Hashtable

    12. Define two public functions, which populate and query the hashtable from above

    Public Function GetRunningTotal(ByVal CurrentPageNumber)

    Return IIF(CurrentPageNumber > 0, RunningTotals(CurrentPageNumber), 0)

    End Function

     

    Public Function SetRunningTotal(ByVal CurrentPageTotal, ByVal CurrentPageNumber)

    RunningTotals(CurrentPageNumber) = CurrentPageTotal + GetRunningTotal(CurrentPageNumber - 1)

    Return RunningTotals(CurrentPageNumber)

    End Function 

    image

    13. Ok, it’s now time to add a Transfooter and Transheader.

    Enable Page Header and Page Footer in the report (click “Report->Page Header” and “Report->Page Footer”).

    14. In the Page Footer I place a text box with the following expression:

    ="Transfooter subtotal = " & Code.SetRunningTotal( Sum(ReportItems!Customer__Debit_Amount_.Value), Globals!PageNumber)

    image

    This code actually performs the following actions:

    - calculate the sum of all “Debit Amount” values on the current page (sic)

    - adds this value to the running total, which has been already calculated for the previous page

    - returns this value as the actual running total for the current page

    15. In the Page header I place a text box with the following expression:

    ="Transheader subtotal = " & Code.GetRunningTotal(Globals!PageNumber-1)

    This code fetches the running total, calculated up to the previous page

    image

    16. And then I set distinctive BackgroundColor and font Color just so this Transfooter and Transheader stand out in my report

    image

    17. Now I’m almost done but I would like to not see the Transheader on the first page and not to see the Transfooter on the last page.

    So I set the following expressions for the “Visibilty->Hidden” properties of the page header:

    =IIF(Globals!PageNumber > 1, False, True)

    And for the page footer:

    =IIF(Globals!PageNumber < Globals!TotalPages, False, True)

    18. Now I’m done, I save, import into NAV and compile. After some fit and finish on the report it now looks like this when I print

    Now I’m done, I save, import into NAV and compile. After some fit and finish on the report it now looks like this when I print:

    clip_image027

    clip_image029

    Question: Would this also work in the example of having a list of sales order lines per sales header and the sales order lines goes to multiple pages?

    Answer: The report above is a bit simplified in order to illustrate the point. It can be easily extended to support your scenario. I.e. the key for the hash should include page number AND header no to accomplish this.

    You can download the report object here, thanks to Nickolay Belofastow.

    /Claus Lundstrøm

  • Microsoft Dynamics NAV Team Blog

    Combined Hotfix Release for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2

    • 4 Comments

    Platform Hotfixes

    With the release of Microsoft Dynamics NAV 2009 R2, the release of platform hotfixes for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2 has been combined. This means that there will be one set of hotfix files that can be used with both Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2.

    The combined hotfixes will start with build number 32074.

    Special note for Microsoft Dynamics NAV 2009 SP1

        In order to install hotfixes with build 32074 and higher, customers who have Microsoft Dynamics NAV 2009 SP1 with a build below 32074 installed, must first perform one of the following steps:

    1. Install hotfix 2496107 - Platform hotfix resource files for Microsoft Dynamics NAV 2009 SP1.

       For more information about the files that need to be installed and how to install the files, see KB 2496107

    1. Perform a solution upgrade to Microsoft Dynamics NAV 2009 R2

       For more information about how to perform a solution upgrade from Microsoft Dynamics NAV 2009 SP1 to Microsoft Dynamics NAV 2009 R2, see Install and Upgrade Instructions for Microsoft Dynamics NAV 2009 R2

    There are no prerequisites for customers who have Microsoft Dynamics NAV 2009 R2 installed.

    For a complete list of all platform hotfixes released for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2, see the following pages on CustomerSource and PartnerSource:

    Note: There are no changes to the release process for platform hotfixes for Microsoft Dynamics NAV 2009 (no service pack).

    Application Hotfixes

    All application hotfixes released for Microsoft Dynamics NAV 2009 SP1 applies to Microsoft Dynamics NAV 2009 R2 as well.

    For a complete list of all application hotfixes released for Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 2009 R2, see the following pages on CustomerSource and PartnerSource:

  • Microsoft Dynamics NAV Team Blog

    Transfooter and Transheader functionality in RDLC(SSRS) reports

    • 3 Comments

    Please note that I have posted a new blog for this subject here. /Claus Lundstrøm

    In our Classic reports we have the possibility to use Transfooter and Transheader. A typical use for classic Transfooters and Transheaders are to show a current subtotals up to the end of the current page or sums per page

    These functions are not directly mapped from Classic reports to RDLC reports in Dynamics NAV 2009, but in this post I will go through how this is done in RDLC reports:

    1. Create new report blank report with table 18

    clip_image001

    2. Create DataItem ”Customer”

    clip_image002

    3. Go to Section Designer and add the following fields:

    · No.

    · Name

    · Debit Amount

    clip_image003

    4. Save the report as ID 50000 – Transfooter / Transheader

    clip_image004

    5. Now go to Visual Studio (View / Layout)

    clip_image005

    6. Create table and add the fields No, Name and Debit Amount

    clip_image006

    7. Give this table the name “MainTable”

    clip_image007

    8. Now we have added the basic for this report. But I would also like to have a Grand total of the Debit Amount so I add this as well. I add this in the Footer of the table

    ="GrandTotal: " & sum(Fields!Customer__Debit_Amount_.Value)

    clip_image008

    9. Now if my report is printed I get a list of my all my customer with Debit Amount displayed and with GrandTotal in the end of the report:

    clip_image009

    10. Now I would like to see the accumulated sum of the Debit Amount on each the page footers, and on the next page display this accumulated sum from previous page. So I will add Transfooter and Transheader functionality to the report.

    11. First we need to do some intermediate calculations to accomplish this.

    Add 3 new columns to the existing table in Visual Studio;

    clip_image011

    12. In the first column enter this expression:

    =RunningValue(Fields!Customer__Debit_Amount_.Value, Sum, "MainTable")

    And give this name “Subtotals1”

    clip_image012

    13. In the Second column enter this expression:

    =RunningValue(Fields!Customer__Debit_Amount_.Value, Sum, "MainTable") - Fields!Customer__Debit_Amount_.Value

    And give this name “Subtotals2”

    clip_image013

    14. In the Third column enter this expression:

    =RunningValue(Fields!Customer__No__.Value, Count, "MainTable")

    And give this name “SubCount”

    clip_image014

    The 3 columns should now look like this:

    clip_image015

    15. As these 3 columns are only used for calculation I will make them really small and set Visibility “Hidden=True” and make the font red so I remember that these columns are hidden.

    Your report should now look like this:

    clip_image016

    16. Ok, it’s now time to add a Transfooter and Transheader. Enable Page Header and Page Footer in the report. You report should look like this:

    clip_image018

    17. In the Page Footer I place a text box with the following expression:

    ="Transfooter subtotal = " & Last(ReportItems!Subtotals1.Value)

    And then I set BackgroundColor, and Color just so this Transfooter stands out in my report, and right align text:

    clip_image019

    clip_image020

    18. In the Page header I place a text box with the following expression:

    ="Transheader subtotal = " & (First(ReportItems!Subtotals2.Value))

    And then I set BackgroundColor, and Color just so this Transfooter stands out in my report, and right align text:

    clip_image021

    clip_image022

    19. Now I’m almost done but I would like to not see the Transheader on the first page and not to see the Transfooter on the last page, so I select properties on the Page Header and set the “PrintOnFirstPage=False”

    clip_image023

    20. Now I could do the same on Page Footer, but maybe I would like to display the Page Footer, but not with the Transfooter displayed, so here is a little trick for how to do this.

    21. Insert a text box below the table and set the expression to “=True”, Name=LastPageControl, Hidden=True and color red.

    clip_image024

    22. With this field added after the table we can now check to see when we are on the last page.

    So I add the following Visibility Expression on the Transfooter textbox:

    =ReportItems!LastPageControl.Value

    clip_image025

    23. Now I’m done, I save, import into NAV and compile. After some fit and finish on the report it now looks like this when I print:

    clip_image027

    clip_image029

    You can download my report here as FOB and XPS.

    Thanks,
    Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

  • Microsoft Dynamics NAV Team Blog

    Automation Objects in Microsoft Dynamics NAV 2009

    • 7 Comments

    Overview

    The Automation object is often used to integrate NAV business logic with external processes and thereby extend the functionality of the product, such as integration with other products like Office. Automation objects must expose a COM interface, and every time we cross a process boundary is worth thinking about performance, but issues that involve correct operation could have a negative impact on performance. This is something we are willing to accept. One example is that objects designed for a single thread execution must execute on Single Threaded Apartment (STA) threads. Having a look at this KB article (http://support.microsoft.com/kb/257757/) explains why office products never should be allowed to run on the server:

    Reentrancy and scalability: Server-side components need to be highly reentrant, multi-threaded COM components that have minimum overhead and high throughput for multiple clients. Office applications are in almost all respects the exact opposite. Office applications are non-reentrant, STA-based Automation servers that are designed to provide diverse but resource-intensive functionality for a single client. The applications offer little scalability as a server-side solution. Additionally, the applications have fixed limits to important elements, such as memory. These cannot be changed through configuration. More importantly, the applications use global resources such as memory mapped files, global add-ins or templates, and shared Automation servers. This can limit the number of instances that can run concurrently and can lead to race conditions if the applications are configured in a multi-client environment. Developers who plan to run more than one instance of any Office application at the same time need to consider "pooling" or serializing access to the Office application to avoid potential deadlocks or data corruption.”

    Architecture

    clip_image001

    Flavors of COM

    Apartment threading

    There are two major flavors of Automation objects, ones that are designed for single threaded applications, and ones that execute well in a multithreaded environment. This doesn’t prevent one from running STA objects on the server and MTA objects on the client, but each scenario where “best practices” are deviated should be considered closely.

    An example would be the XML Document object

    clip_image003

    The DOMDocument is a single threaded apartment version and the FreeThreadedDOMDocument is the version that utilizes a multithreaded environment, like the server. But in cases where we a free threaded version of the object is not available, it would properly be acceptable to use the version available, because the .Net runtime is managing MTA-to-STA marshaling behind the scene. This could result in bad performance and other problems – but in most scenarios it is likely to work. A closer look at “PRB: MSXML Performance Bottleneck in ShareMutex Under Stress” explains why issues like these must be considered.

    “Using the MSXML parser in a high-stress environment … may cause unusually long run times on XML requests, and the application or service can appear to stop responding (hang).“

    And the solution in this scenario would be to use the FreeThreadedDOMDocument object on the server.

    Native and Managed Automation Objects

    The Automation implementation in the Role Tailored Client and the Dynamics NAV Server utilizes the CLR implementation, and the CLR does an excellent job of allowing managed code to call out to unmanaged Automation objects. It generates a runtime-callable wrapper (RCW) proxy that implements all of the interfaces of the underlying object. Furthermore, the CLR has a built-in mapping/marshaling layer that knows how to translate the types between the native and managed domains.

    The following table shows the specific type mappings between AL, COM and their corresponding .NET types.

    clip_image004

    All the Automation objects are late bound activated; this means that they must implement the IDispatch interface, in order for the Reflection API to be able to invoke members. Managed Automation objects are recognized by the RCW as being managed and standard CLR reflection invocation takes place. Therefore, in-process (dll) and Out-of-process (exe) Automation behaves identically if the objects are created in a managed language.

    Security

    The default account for running the NAV Server, configured at installation time, is the built-in Network Service account. This account does not have permissions to spawn a new process, as configured in Component Services, and it is not recommended to change that behavior. This is by design, in order to prevent out-of-process Automation servers (Executables with a COM Interface) to execute on the server. But if the scenario requires this, it would be a recommended practice to create a new service account with the minimum privileges plus the “Launch and Activate Permissions” of the required Automation Servers. These processes will then be created on the server and properly stays alive until they receive a specific terminate command, or the server is rebooted. Another risk with Automation servers on the NAV Server machine is that users could potentially share the same Automation process. In AL, the construct CREATE (automationServer, TRUE), will search the system for created instances of type “automationServer” and try to reuse that process, and potentially read data created by another user.

    Therefore the recommended syntax would be CREATE(automationServer, FALSE, FALSE), for Automation servers running on the NAV Server. On the client tier, no sharing can occur and it would be perfectly fine to try and reuse the Automation server.

    The in-process Automation objects whether they are created on the client or server tier are hosted by the running process and inherit the security context of the active user. The same goes for OCX controls that require an UI and therefore only will be allowed on the client side.

    Wrap-up (recommendations)

    Server tier
      • Native Automation objects: In-process automation servers, like MSXML6.dll.
      • Objects with a user interface such as OCX types.
      • Managed wrapped COM Objects
      • Objects designed for multi threaded execution (MTA)
    Client tier
    • Native Automation objects: Out of process automation servers, like Microsoft Office.
    • Objects with a user interface such as OCX types.
    • Objects designed for single threaded execution (STA)
    General
    • It is good practice to design your Automation interfaces to get as much work done in a single method invocation. And when consuming a component, try to use it in way that minimizes chattiness. This is utmost importance for the client side automation scenario.

    Sample

    COM is an immutable, interface-based model. Interface design is very important and should always be split from the implementation. Try to avoid auto-generated interfaces based on classes as they have a tendency to violate this guideline and not version well. There is a good source of information at: “Do not use AutoDual ClassInterfaceType“

    image

    (see the first comment on this post for the text of this sample)

    - Stefan Omdahl

  • Microsoft Dynamics NAV Team Blog

    Microsoft Dynamics NAV Compatibility with Microsoft Office 2010 and Microsoft SharePoint 2010

    • 8 Comments

    With the release of Office 2010 and SharePoint 2010 the relationship between internal line of business applications and business productivity software is stronger than ever. There have been added many exciting new features, which will bring value to many customers, including those customers that are using Microsoft Dynamics NAV today.

    User Interface

    The user interface (UI) is the "face" of a software application - A good user interface is intuitive, familiar, and easy to use. It improves productivity by minimizing the number of clicks required to get a task done. This is what we accomplished with the release of the RoleTailored client in Microsoft Dynamics NAV 2009. The Fluent UI is now used by all Microsoft Office programs as well as SharePoint Server 2010, and does away with menus, which were growing increasingly complex, replacing them with a clear set of icons that are relevant to the task being performed.

    With the 2010 release, Microsoft Office, Microsoft SharePoint Server, and Microsoft Dynamics now share this strong "facial" resemblance, making them more consistent to use and easier to adopt.

    Connectivity

    Just as beauty is more than skin deep, so the ties between Microsoft Dynamics and Microsoft's business productivity infrastructure run deeper than just the UI.  Business Connectivity Services (BCS) is a new technology that crosses Microsoft Office 2010 and Microsoft SharePoint Server 2010, and can be thought of as "plumbing" for connecting business applications through Web Services in Microsoft Dynamics NAV 2009 with SharePoint and Office. This is no ordinary plumbing, though, as it enables some powerful new scenarios for Microsoft Dynamics NAV customers, including the ability to update information stored in a Microsoft Dynamics NAV database directly from a SharePoint site, and making it easier to take Microsoft Dynamics NAV information offline through either Outlook 2010 or SharePoint Workspace 2010. 

    Analysis

    The majority of Microsoft Dynamics customers use Microsoft Excel to analyze their business information. PowerPivot for Microsoft Excel 2010 offers the ability to quickly create PivotTables or PivotCharts that are pulling in data from Microsoft Dynamics ERP or CRM in real time. New Excel 2010 features such as Slicers and Sparklines can then be added to bring the numbers to life and gain deeper insights into what's happening in the business.  

    Compatibility

    Since Microsoft Dynamics NAV always has had a strong integration to the Office and SharePoint products, we are proud to announce that Microsoft Dynamics NAV 2009 SP1 and Microsoft Dynamics NAV 5.0 SP1 Update 2 are compatible with Microsoft Office 2010 and Microsoft SharePoint 2010!

    The details in the support for the different Office and SharePoint integrations are listed below. Please note that Office 2010 is available in both a 32-bit version and a 64-bit version, but some NAV areas are currently not supported in the 64-bit version. The recommended version of Office 2010 in combination with NAV is the 32-bit version. Further reading on the difference between the two versions can be found here: http://blogs.technet.com/b/office2010/archive/2010/02/23/understanding-64-bit-office.aspx.  

    1. Employee Portal is supported for SharePoint 2010. However please look at KB970502 for instructions on how to install in a 64-bit environment.
    2. Sending data from Microsoft Dynamics NAV to both Word and Excel using the basic export is fully compatible with Microsoft Office Word 2010 and Microsoft Office Excel 2010. The same applies exporting to Excel from reports and to Export of budgets, Analysis Schedules etc.
    3. Interactions such as letters can be initiated from Microsoft Dynamics NAV and stored as appropriate in Microsoft Office Word 2010 in both 32-bit and 64-bit version.
    4. Sending emails from Microsoft Dynamics NAV is compatible with Outlook 2010 32-bit version, but is currently not supported for the 64 bit version.
    5. Outlook Synchronization is compatible with Outlook 2010 32-bit version. The installation and the add-in is not currently supported for the 64- bit version.
    6. Email logging is dependent on CDO, which is not supported in Office 2010. Please read http://support.microsoft.com/kb/2028411. A possible workaround has been identified by manual installing CDO in combination with KB2291071, but it is recommended to stay on Office 2007 if email logging is required.
  • Microsoft Dynamics NAV Team Blog

    Manually restoring the NAV 2013 Demo Database

    • 2 Comments

    With the release of Microsoft Dynamics NAV 2013, there are some new procedures for restoring the demo database manually.  I have outlined the necessary steps below.

    1)    From within the Microsoft SQL Server Management Studio, restore the Microsoft Dynamics NAV 2013 demo database from the installation media (..\SQLDemoDatabase\CommonAppData\Microsoft\Microsoft Dynamics NAV\70\Database).

    2)    To restore the database from the Microsoft SQL Server Management Studio, open the Object Explorer and click on Databases.  With Databases highlighted, right click and select Restore Database.

    3)    This will open up the Restore Database window.  Select the Device option in the Source grouping. 

    4)    Now click on the assist edit button () and this will launch the Select backup devices window.

    5)    Next, click on the Add button to launch the Locate Backup File window and select the demo database backup file.

    6)    Once you have selected your file, click OK to exit the Locate Backup File window.  Once you return to the Select backup devices window, click on OK again.

    7)    You should now be on the Restore Database - Demo Database NAV (7-0) window - unless you have changed the value of the Database field then the window title would differ.  Make sure that the file listed in the Backup sets to restore section has a check mark next to it.  If you want to change where the database files are created, you can specify this on the Files page.  If you want to specify any Restore options this can be done on the Options page.  For this blog, it is assume that you will take the default settings.

    8)    Click OK to restore the database.

    9)    After the restore finishes, go to the Object Explorer and expand the Databases object.  The list of database objects should now have one named Demo Database NAV (7-0).

    10)  Next, expand the Demo Database NAV (7-0) object and select the Security\Schemas object.  Expand this object and make sure the $ndo$listener schema doesn't already exist.  If you had already installed NAV 2009 on this SQL Server,  then this schema may already exist.  If it does, go to step 12.  If it doesn't, then right click on the Schemas object and select New Schema

    11)   With the Schemas Properties window open, enter $ndo$navlistener in the Schema Name field.  

    Note: You will not be able to state a schema owner until the next step.  There are no values to fill in on either the Permissions or Extended Properties tabs.

    12)   Create a user in the Demo Database NAV (7-0) named NT AUTHORITY\NETWORK SERVICE or whatever user that will be used to login the NAV Server Service.

    13)   Enter $ndo$listener in the Default schema field on the General page.

    14)   On the Owned Schema page, make sure the $ndo$listener is marked.

    15)   On the Membership page, make sure that the following Role Members are selected

      • db_datareader
      • db_datawriter
      • db_ddadmin

    16)   On the Securables or Extended Properties pages, there is no information to fill in.

    17)   The last step before starting your new NAV Server, locate your new database and right-click and select the Properties option.  Select the Permissions Page.  You should see NT AUTHORITY\NETWORK SERVICE or whatever user that will be used to login the NAV Server Service on the right side of the page.

    Below that you will see a tab for Explicit Permissions for NT AUTHORITY\NETWORK SERVICE or whatever user that will be used to login the NAV Server Service.  Make sure that is a check in the following permissions 

      • Connect
      • View database state

    Once those are selected then click OK.

    18)   Use the Microsoft Dynamics NAV Administration tool to update the NAV Server settings with the new demo database name and restart the NAV Server.

     

     

    NOTE: If you were to use the Microsoft Dynamics NAV 2013 Installer to install the demo database, it would have run a script that would have executed each of these steps for you.

    Now, enjoy using Microsoft Dynamics NAV 2013!!!

     

Page 1 of 44 (650 items) 12345»