September, 2011

  • Microsoft Dynamics NAV Team Blog

    Jet Reports Express for Microsoft Dynamics NAV is Now Available for Download!

    • 4 Comments

    It is with great satisfaction that we can announce the release of Jet Reports Express for Microsoft Dynamics NAV.

    In the last couple of months we have talked about the exiting addition to the Microsoft Dynamics NAV Business Intelligence and Reporting proposition and now it is here. As of today Jet Reports Express for Microsoft Dynamics NAV is available for download at PartnerSource and CustomerSource for customers on an active Business Ready Enhancement Plan.

  • Microsoft Dynamics NAV Team Blog

    Double impersonation within a three tier environment and the SMTP Server setup in Microsoft Dynamics NAV

    • 0 Comments

    Not that long ago I was involved with a very interesting escalation stating that it was not possible to send out E-mails via CU400 utilizing NTLM in a three tier environment with the Role Tailored Client only in an Exchange Server 2007 / 2010 environment. When using the CSIDE Client, everything worked perfectly. The cause is that the Role Tailored Client in a three tier environment sent the E-mail to the NST box that uses impersonation to send out an E-mail. What happens from technical side of view is that some sort of double impersonation had to take place.

    The solution is too easy to implement but let me first try to explain this with the scenario I worked on. For the test I did use Document Approval scenario. This does utilize CU400. Before actually describing the scenario, I reviewed the following patches for SMTP:

    2499881    You cannot configure the TLS settings for SMTP communication in Microsoft Dynamics NAV 2009
    https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;EN-US;2499881

    2345735    You cannot change the default port for SMTP Communication in Microsoft Dynamics NAV
    https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;EN-US;2345735

    2479702    The email message body is incorrect when you create an email message by using the AppendBody method in Microsoft Dynamics NAV 2009 Service Pack 1
    https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;EN-US;2479702

    2280492    Attachments are not released until the Microsoft Dynamics NAV client is closed when you use the SMTP Mail codeunit (400) to send email messages that have attachments
    https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;EN-US;2280492

    2516144    You receive malformed email messages if you use a specific version 7 release of the Microsoft.Navision.Mail.dll file in Microsoft Dynamics NAV 2009
    https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;EN-US;2516144

    1. install Exchange 2007 SP1 on Windows Server 2008 R2
    2. install SQL Server 2008 R2 on Windows Server 200x R2
    3. install ServiceTier + RTC on Windows Server 2088 R2
    4. install CC and RTC on Windows 7

    NOTE: for the test all relevant Windows Updates were installed, latest service packs and latest builds of Dynamics

    5. create a new account called NAVSRV which will be used to start up SQL / NST
    6. configure Document Approval according to the attached PPT

    NOTE: for the test we will primarily use the accounts called Susan, Navsrv and Kevin which is a newly created Salesperson
    NOTE: for the test all user accounts are SUPER users in Dynamics NAV, Local Administrators on all machines being used and member of Domain Admin
    NOTE: the following machine names are being used:

    => EX2K7-1 : Exchange 2007 SP3
    => WIN2K3-3 : SQL 2008 R2
    => WIN2K3-4 : NST + RTC
    => WIN7-2 : CC + RTC

    NOTE: the following spn's were used and set to the NAVSrv user account:

    userPrincipalName: navsrv@mels.com
    servicePrincipalName: MSSQLSvc/win2k3-3.mels.com:1433
    servicePrincipalName: MSSQLSvc/win2k3-3.mels.com
    servicePrincipalName: http/WIN2K3-4.mels.com
    servicePrincipalName: http/WIN2K3-4
    servicePrincipalName: DynamicsNAV/WIN2K3-4:7046
    servicePrincipalName: DynamicsNAV/WIN2K3-4.mels.com:7046

    NOTE: the following Delegations were setup for NAVSrv account:

    Trust this user for delegation to specified services only:

    - Use any authentication protocol

    MSSQLSvc win2k3-3.mels.com 1433

    7. follow MSDN to ensure the three tier environment is configured correctly

    Test:
    => start up RTC on Windows 7 using user account Susan [OK}

    8. review the above mentioned patches for SMTP and modify the code where needed
    9. run the following command regasm /codebase microsoft.navision.mail.dll /tlb:microsoft.navision.mail.tlb using build v7.03.1
    10. compile the non compiled objects
    11. configure CU400 with the following values:

    EX2K7-1
    NTLM
    25

    12. start up Exchange 2007 MMC and create a new Receive Connector, to do so follow these steps:

    => select Microsoft Exchange / Server Configuration / Hub Transport
    => select an empty area under button Receive Connectors and right click, New Receive Connector

    13. configure the newly created connector with the following values:

    General tab:
    => Name: CRM Connector
    => mail.mels.com

    Network tab:
    => local IP address of EX2K7-1, port 25
    => remote IP address of WIN2K3-4
    => Authentication: Integrated Windows Authentication

    Permissions Groups:
    => Exchange servers

    14. create a new Send Connector, to do so, follow these steps:
    => select Microsoft Exchange / Organization Configuration / Hub Transport
    => select Send Connectors
    => select an empty area under button Send Connectors and right click, New Send Connector

    15. configure the newly created connector with the following values:

    General tab:
    => Name: SMTP Send connector
    => Address Space: SMTP * 1

    Network tab:
    => Route mail through the following smart hosts
    => Smarthost: IP address of remote Exchange 2003 server (not part of this test)

    Source Server tab:
    EX2K7-1 Default-First-Site-Name Mailbox, Client Access, Hub Transport

    Test:
    => log on to WIN7-2 with user account Susan using CC and create a Purchase Quote so that an approval request needs to be done (> 5000)
    => the approval request is created and an E-mail is sent to Kevin

    Test:
    => log on to WIN7-2 with user account Susan using RTC and create a Purchase Quote so that an approval request needs to be done (> 5000)

    Error on the client:

    The SMTP mail system returned the following error: The SMTP server requires a secure connection or the client was not authenticated. The server respones was: 5.71. Client was not authenticated.

    Error on EX2K7-1 application event log file:
    The account 'NT AUTHORITY\ANONYMOUS LOGON' provided valid credentials, but is not authorized to use the server; failing authentication

    NOTE: The errors are well known and described in the MS Exchange 2007 Transport whitepaper (http://www.microsoft.com/download/en/details.aspx?id=975):

    530 5.7.1 Client was not authenticated

    The sender specified in the MAIL FROM field of the SMTP protocol doesn't have permission to submit to this server. The ms-Exch-SMTP-Submit permission must be granted to the sender.

    16. add extended permissions to the newly created connector:

    Get-ReceiveConnector "CRM Connector" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "ms-Exch-SMTP-Accept-Submit"

    Test:
    => log on to WIN7-2 with user account Susan using RTC and create a Purchase Quote so that an approval request needs to be done (> 5000)

    Error on the client (described in the whitepaper):
    550 5.7.1 Client does not have permission to send as this sender

    The sender specified in the MAIL FROM field of the SMTP protocol conversation is an address in an authoritative domain. However, the session doesn't have the ms-Exch-SMTP-Accept-Authoritative-Domain-Sender permission. This might occur if a message was submitted from the Internet to an Edge Transport server from a sender address for which the Exchange organization is authoritative.

    17. add extended permissions to the newly created connector:

    Get-ReceiveConnector "CRM Connector" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "ms-Exch-SMTP-Accept-Authoritative-Domain-Sender"

    Test:
    => log on to WIN7-2 with user account Susan using RTC and create a Purchase Quote so that an approval request needs to be done (> 5000)

    Error on the client (described in the whitepaper):
    550 5.7.1. Unable to relay

    The recipient domain to which the message is addressed isn't within any of the accepted domains defined for this organization. Also, the session doesn't have the ms-Exch-SMTP-Accept-Any-Recipient permission.

    18. add extended permissions to the newly created connector:

    Get-ReceiveConnector "CRM Connector" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "ms-Exch-SMTP-Accept-Any-Recipient "

    Test:
    => log on to WIN7-2 with user account Susan using RTC and create a Purchase Quote so that an approval request needs to be done (> 5000)
    => the approval request is created and an E-mail is sent to Kevin

    19. change SMTP Mail Setup in Dynamics NAV to Anonymous

    Test:
    => log on to WIN7-2 with user account Susan using RTC and create a Purchase Quote so that an approval request needs to be done (> 5000)
    => the approval request is created and an E-mail is sent to Kevin

    NOTE: when using RTC with user account NAVSrv on the NST box, switching between Anonymous and NTLM does produce the correct behavior. Mail cannot be sent with error 530 5.7.1 Client was not authenticated and mail can be sent without error.

    Along the way we had quite a lot of fun while testing. If you run in this kind of scenario, the way to fix this is via code in CU400 where you instruct the RTC to directly contact the Exchange Server in stead of via the NST box. This will ensure the Role Tailored Client behaves similar as the CSIDE Client:
    2618652 Double impersonation and the SMTP Server setup in Dynamics NAV
    http://support.microsoft.com/kb/2618652

    Regards,

    Marco Mels
    CSS EMEA

    This posting is provided "AS IS" with no warranties, and confers no rights

  • Microsoft Dynamics NAV Team Blog

    Printers list in Microsoft Dynamics NAV

    • 2 Comments

    Periodically we receive support requests with questions about available printers list in NAV. Especially about situations when this printers list includes or not includes some printers unexpectedly and issues especially comes when there is used Microsoft Terminal Servers or Citrix.

    Situation changed when NAV developing team replaced previous used GetProfileString to winspool function EnumPrinters. This was replaced in Microsoft Dynamics NAV 5.0 Sp1 with fix by KB 2592845 and in Microsoft Dynamics NAV 2009 SP1 with fix by KB 2575152.

    About function EnumPrinters you can read at http://msdn.microsoft.com/en-us/library/dd162692(v=VS.85).aspx. NAV is using flags PRINTER_ENUM_LOCAL and PRINTER_ENUM_CONNECTIONS and level 2 for printers list. However we still sometimes receive the same issues:
    printers list is not correct.

    So I made little C# application which shows printers list the same way as NAV does and I would like you run it and compare results with list in NAV or list in Windows devices whenever you met any problems.


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;

    internal class clPrintersList
    {
    [DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)]
    private static extern bool EnumPrintersA(
    PrinterEnumFlags Flags,
    string Name,
    uint Level,
    IntPtr pPrinterEnum,
    uint cbBuf,
    ref uint pcbNeeded,
    ref uint pcReturned);


    public static string[] GetPrinterNames(PrinterEnumFlags PEF)
    {
    List<string> returnVal = new List<string>();
    foreach (PRINTER_INFO_2 info in EnumPrinters(PEF))
    {
    returnVal.Add(info.pName);
    }
    return returnVal.ToArray();
    }



    private static PRINTER_INFO_2[] EnumPrinters(PrinterEnumFlags Flags)
    {
    uint cbNeeded = 0;
    uint cReturned = 0;
    if (EnumPrintersA(Flags, null, 2, IntPtr.Zero, 0, ref cbNeeded, ref cReturned))
    {
    return null;
    }
    int lastWin32Error = Marshal.GetLastWin32Error();
    if (lastWin32Error == 122)
    {
    IntPtr pAddr = Marshal.AllocHGlobal((int)cbNeeded);
    if (EnumPrintersA(Flags, null, 2, pAddr, cbNeeded, ref cbNeeded, ref cReturned))
    {
    PRINTER_INFO_2[] printerInfo1 = new PRINTER_INFO_2[cReturned];
    int offset = pAddr.ToInt32();
    Type type = typeof(PRINTER_INFO_2);
    int increment = Marshal.SizeOf(type);
    for (int i = 0; i < cReturned; i++)
    {
    printerInfo1[i] = (PRINTER_INFO_2)Marshal.PtrToStructure(new IntPtr(offset), type);
    offset += increment;
    }
    Marshal.FreeHGlobal(pAddr);
    return printerInfo1;
    }
    lastWin32Error = Marshal.GetLastWin32Error();
    }
    throw new System.ComponentModel.Win32Exception(lastWin32Error);
    }


    private struct PRINTER_INFO_2
    {
    [MarshalAs(UnmanagedType.LPStr)] public string pServerName;
    [MarshalAs(UnmanagedType.LPStr)] public string pName;
    [MarshalAs(UnmanagedType.LPStr)]
    public string pShareName;
    [MarshalAs(UnmanagedType.LPStr)]
    public string pPortName;
    [MarshalAs(UnmanagedType.LPStr)]
    public string pDriverName;
    [MarshalAs(UnmanagedType.LPStr)]
    public string pComment;
    [MarshalAs(UnmanagedType.LPStr)]
    public string pLocation;
    public IntPtr pDevMode;
    [MarshalAs(UnmanagedType.LPStr)]
    public string pSepFile;
    [MarshalAs(UnmanagedType.LPStr)]
    public string pPrintProcessor;
    [MarshalAs(UnmanagedType.LPStr)]
    public string pDatatype;
    [MarshalAs(UnmanagedType.LPStr)]
    public string pParameters;
    public IntPtr pSecurityDescriptor;
    public Int32 Attributes;
    public Int32 Priority;
    public Int32 DefaultPriority;
    public Int32 StartTime;
    public Int32 UntilTime;
    public Int32 Status;
    public Int32 cJobs;
    public Int32 AveragePPM;
    }


    [FlagsAttribute]
    internal enum PrinterEnumFlags
    {
    PRINTER_ENUM_DEFAULT = 0x00000001,
    PRINTER_ENUM_LOCAL = 0x00000002,
    PRINTER_ENUM_CONNECTIONS = 0x00000004,
    PRINTER_ENUM_FAVORITE = 0x00000004,
    PRINTER_ENUM_NAME = 0x00000008,
    PRINTER_ENUM_REMOTE = 0x00000010,
    PRINTER_ENUM_SHARED = 0x00000020,
    PRINTER_ENUM_NETWORK = 0x00000040,
    PRINTER_ENUM_EXPAND = 0x00004000,
    PRINTER_ENUM_CONTAINER = 0x00008000,
    PRINTER_ENUM_ICONMASK = 0x00ff0000,
    PRINTER_ENUM_ICON1 = 0x00010000,
    PRINTER_ENUM_ICON2 = 0x00020000,
    PRINTER_ENUM_ICON3 = 0x00040000,
    PRINTER_ENUM_ICON4 = 0x00080000,
    PRINTER_ENUM_ICON5 = 0x00100000,
    PRINTER_ENUM_ICON6 = 0x00200000,
    PRINTER_ENUM_ICON7 = 0x00400000,
    PRINTER_ENUM_ICON8 = 0x00800000,
    PRINTER_ENUM_HIDE = 0x01000000
    }

    }

    namespace PrintersList
    {
    class Program
    {
    static void Main(string[] args)
    {

    //>> Local printers list
    Console.WriteLine("Local printers list:");

    string[] ListLocal;
    ListLocal = clPrintersList.GetPrinterNames(clPrintersList.PrinterEnumFlags.PRINTER_ENUM_LOCAL);
    int count = 1;

    foreach (string name in ListLocal)
    {
    Console.WriteLine("Device {0} local - {1}", count, name);
    count += 1;
    }


    //>> "Connected" printers list
    Console.WriteLine("\nConnected printers list:");

    string[] ListCon;
    ListCon = clPrintersList.GetPrinterNames(clPrintersList.PrinterEnumFlags.PRINTER_ENUM_CONNECTIONS);
    int count2 = 1;

    foreach (string name in ListCon)
    {
    Console.WriteLine("Device {0} connected - {1}", count2, name);
    count2 += 1;
    }

    Console.WriteLine("\nEnd Of List... \nIf you want to save to file, use something like:\nPrinterslist.exe >> file.txt");
    Console.WriteLine("\nPress any key...");
    Console.ReadKey();
    }
    }
    }


    You can create new C# console project in Visual Studio, copy/paste code from my file and compile project. Received exe file run from “cmd”, it shows 2 lists: local printers list (included redirected printers) and connected printers list (printers connected to PC remotely). If you run application like PrintersList.exe >> list.txt then you will have list saved to txt file.

    There are few points I want you to pay attention:

    1. Level 2 in function EnumPrinters means: function performs an OpenPrinter call on each remote connection. If a remote connection is down, or the remote server no longer exists, or the remote printer no longer exists, the function must wait for RPC to time out and consequently fail the OpenPrinter call. You can modify application to use level 1 or 4 which, according documentation, are faster.
    2. Run application as “normal user” and run it “as administrator” and compare lists. I’ve seen cases where these lists have many differences – it means some printers are not available for normal users.
    3. There can be issues with printer names. NAV has limited total memory size for printer’s names, if there are hundreds of printers with “long names”, it can be last printers are not in the NAV list.

     

    Any questions/comments are welcome :)

     

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

    Best Regards

    Gedas Busniauskas

    Microsoft Lithuania

    Microsoft Customer Service and Support (CSS) EMEA

  • Microsoft Dynamics NAV Team Blog

    How to Credit a Purchase Containing an Item Charge

    • 1 Comments

    The following blog post is to provide guidance for users of the Inventory costing functionality within Microsoft Dynamics NAV. The specific article is designed for providing guidance when a Purchase Return/Credit Memo is processed where the original Purchase includes Item Charge lines for freight or other additional costs. The information specifically identifies a best practice regarding the processing of an Item Charge line on a Purchase Credit Memo. In the discussion, guidance proves that the Item Charge should be applied against the original Purchase Receipt instead of applying the Item Charge to the Purchase Return/Credit Memo line for the Items being returned to correctly reverse the G/L Entries and all related costs for the Item Ledger Entries and Value Entries involved. A comparison of entries to the G/L are included for when the Purchase Return/Credit Memo Line for the Item Charge is applied to the original Purchase Receipt Item Ledger Entries verses if it is applied to the Purchase Return/Credit Memo line for the Items being returned. A full reversal of the original transaction at the G/L Entry level and Item Ledger Entry level will only occur if the Purchase Return/Credit Memo Item Charge line is correctly assigned to the original Purchase Receipt – not to the Purchase Return Line for the Item.

    Scenario: How to Credit a Purchase Invoice with Item Charges

    This scenario is carried out in W1 Cronus.

    Default values are used if nothing else is stated.

    1. Open Inventory Setup form (Warehouse -> Setup -> Inventory Setup) and set following:

    • Automatic Cost Posting: Yes
    • Automatic Cost Adjustment: Always

    2. Create new Item (Purchase -> Planning -> Items)

    • Description: Test Item Charges
    • Base Unit of Measure: PCS
    • Gen. Prod. Posting Group: RETAIL
    • VAT Prod. Posting Group: VAT25
    • Inventory Posting Group: RESALE

    3. Create new Purchase Invoice (Purchase -> Order Processing -> Invoices)

    • Buy-from Vendor No.: 10000
    • Vendor Invoice No.: 123

    with following lines:

    Purch.line:

    4. Assign Item Charge to purchase line 1, item 70061 (On the Lines FastTab, click Actions -> Line -> Item Charge Assignment). Post the Invoice.

    Created G/Lentries: Source code INVTPCOST

    Created G/Lentries: Source code PURCHASES

    Status Item ledger entry and attached Value entries.

    Assigning an item charge to an inbound entry makes the item charge to be a part of the acquisition cost. The amount of the freight fee is recorded in the Cost Amount (Actual) field in a separate Value entry representing the Item charge.

    5. Create a new Credit Memo (Purchase -> Order Processing -> Purchase Credit Memos):

    • Buy-from Vendor No.: 10000
    • Vendor Cr. Memo No.: CR123

    5. a) Click Actions, Functions, Get Posted Document Lines to Reverse, and choose lines from the invoice created in step 4.

    The purchase credit memo is populated with the lines from the invoice, as below.

    The Item line is automatically fixed applied to the original receipt, Item ledger entry 317.

    5. b) Assign Charge(Item) (On the Lines FastTab, click Actions -> Line -> Item Charge Assignment).

    The line from the Purchase Credit memo is suggested.

    5. c) Delete the suggested line or keep it as it is but be thorough in the next step.

    5. d) In the Item Charge Assignment form choose Functions -> Get Receipt lines.

    Choose the Receipt line that represents the original receipt created by the Purchase invoice. This is actually the key if a purchase invoice with item charge is to be reversed and achieve a full reversal of earlier posting to the General Ledger.

    Assign the Quantity to the Receipt line as below. In this case the suggested line from the Credit memo was deleted. Note the Applies-to Doc Type at the left.

    5. e) After having the Item charge assigned the Credit memo shall be Posted.

    Status Item ledger entry of Original Purchase Receipt and attached Value entries:

    The initial Item charges are now reversed, reversing the initial acquisition cost carried in field Cost Amount (Actual).

    Status Item ledger entry of Purchase Return Shipment created by the Purchase Credit memo.

    Created G/L entries: Source code INVTPCOST

    Created G/L entries: Source code PURCHASES

    The respective G/L entries are also demonstrated in the T-accounts. Below is the T-account schema describing Postings to Inventory accounts + Purchase account. Accounts used as in W1 Cronus database. VAT, payables accounts are not described.

     

     

    If the Item charge is assigned to the purchase credit memo line:

    Using the same scenario and jumping directly into the Purchase Credit memo

    5. d) The Item charge is assigned to suggested Credit memo line.

    If the Item charge instead is assigned to the suggested Credit memo line. The item charge will be considered as a Non-inventoriable cost. The items that the item charge is assigned to are removed from inventory, the cost amount does not affect the inventory value.

    The Credit memo is posted.

    Created G/L entries: Source code INVTPCOST

    Created G/L entries: Source code PURCHASES

    Created G/L entries: Source code INVTPCOST

    This G/L Register with Source code INVTPCOST is created by the Adjust cost item entries batch job that is running automatically in this scenario. The cost of the original Receipt is recognized to totally 1100 and therefore additonal 100 is forwarded to the Purchase Return. The additional cost follows the settings of the original item and do not differentiate or recognize the cost to be caused by an Item charge. Note the accounts the adjustment addresses versus what was recognized in the scenario above.

    Status Item ledger entry of Purchase Return Shipment created by the Purchase Credit memo.

    The respective G/L entries are also demonstrated in the T-accounts.

     

    Helene Holmin

    Product Escalation Engineer Navision

    EMEA Customer Support & Services SMS&P

  • Microsoft Dynamics NAV Team Blog

    Using PowerShell to configure Dynamics NAV Services

    • 2 Comments

     

    The Microsoft All-In-One Code Site has a new NAV code sample. This time it demonstrates using PowerShell to

    1. Get a list of NAV 2009 Services, either on the local machine or on a remote machine, and
    2. Start and stop a service

    The sample also includes a small bit of XML, so that you can use it to update CustomSettings.config.

    With quite small amounts of code, by combining PowerShell and XML, you can control a NAV Service - either locally or remotely - without the need for Notepad, opening services, finding CustomSettings.config in Windows Explorer, etc.

    You can download the sample or just browse the sample code from this link:

     Download Microsoft Dynamics NAV APPLICATION: CSDynamicsPowerShellAdmin

     

    This is sample code only. It is specifically designed not to be a full app so it has lots of scope for adding functionality. Hopefully it can be useful as a starting point or inspiration for developing own tools.

     

    After downloading the code sample and building it in Visual Studio 2010, then running "CSDynamicsPowerShellAdmin.exe" (run it as Administrator), this is what it looks like when running it from my test machine:

     

    And this is what it can do:

    • Click "Get NAV Services" to list local NAV Services. It finds Services where pathname like \"%Dynamics.Nav%\".
    • Enter the name of another machine and then click "Get NAV Services" to get a list of NAV Services on that machine. Assuming that you are administrator on that machine.
    • Select a NAV Service in the list to see Service properties like Name, Account, Status etc.
    • Click "Get Config" to read parts of CustomSettings.config for the selected NAV Service.
    • Overwrite values, then click "Update Config" to update CustomSettings.config.
    • Start and Stop the selected NAV Service. This only works if you are running it with elevated privileges.

     

     

    Lars Lohndorf-Larsen

    Dynamics NAV Support EMEA

     

  • Microsoft Dynamics NAV Team Blog

    Object Metadata update flow in Microsoft Dynamics NAV 2009

    • 0 Comments

    My colleague Lars described in BLOG post “About Object Metadata, and why I can’t see object changed in RTC” and explained how to troubleshoot metadata update problems.
    With current post I’m trying to overview whole process and make it more clearly for all.

    So we have few moments I want to clarify in beginning (something like glossary).

    In Microsoft Dynamics NAV 2009 (NAV) we have few parts:

    • ·         SQL server – storing data (including objects);
    • ·         NAV Service Tier (NST) – storing metadata and timestamp in cache;
    • ·         Classic Client (CC) – modifying, compiling saving to SQL objects.
    • ·         Role Tailored Client (RTC) uses metadata. It requests NST to load metadata depend on what RTC user needs to use.

    In SQL server we have 3 important tables:

    • ·         Table 2000000071 Objects Metadata – it stores object metadata and when NST needs to receive objects, it receives from this table.
    • ·         Table 2000000079 Object Tracking -  it stores last object update date -  really it is timestamp of moment when object was updated. Because timestamp is increasing with any action in SQL database, then latest object update always has bigger timestamp. If timestamp for some object is bigger that cached object timestamp, then cache must be updated, because it has older object version.
    • ·         Table2000000001 Object – it stores C/side object code and with this table we are working with CC when modify, compile objects.

    There is SQL Server Broker (or Polling) – special processes track changes in table 2000000079 Object Tracking. This is described in Lars BLOG article mentioned before.

    No we are going to 1st schema:

    This is common flow how objects are going in NAV.

    Main points are:

    1. 1.       NST loads to cache object metadata when starts (actually when RTC connects).
    2. 2.       CC (C/SIDE) compiles object and updates Object; Object Tracking and Object Metadata tables.
    3. 3.       SQL Server Broker or Polling catch changes in timestamp and request to update cached object timestamp on NST.

    NST and RTC metadata update process schema:

    Main points here:

    • ·         NST loads metadata with timestamps from database by RTC requests.
    • ·         When timestamp is changed for some object in database, change listener updates NST with new timestamp and NST removes old metadata.
    • ·         Now situation is that NST has new timestamp as RTC runs metadata with older timestamp.
      • However if RTC runs older metadata, then system can detect: is there running dependent metadata which requires only new metadata here. If dependent metadata requires updated object then error about “updated metadata” is showed and RTC requests to update metadata. But if there is no dependent metadata then old object is running as long as needed (until user finishes process).
    • ·         When the same object metadata needs to be run, RTC requires updating metadata on NST.

     

  • Microsoft Dynamics NAV Team Blog

    Are reservations being impacted with stock adjustments?

    • 0 Comments

    Sometimes we need to post stock adjustments (negative adjustment, phys. inventory journal, ...). We need to correct the stock in NAV to make it consistent with physical stock. But, how does this affect the reservations that might already exist?

    If we have stock and we have reservations against that stock, this won't be impacted by any future stock adjustment. The reason is because NAV wouldn't know what is the reservation to cancel. Thus, user (business mind :-)) should know this and should manually adjust the reservations to make both stock and reservations consistent.

    NAV current logic does not provide any warning when stock adjustment impacts reservations. However, future change might consider if the stock after adjustment is consistent with existing reservation. If not, a warning will be raised so user is aware and can react accordingly.

    The scenario here is:

    • Stock of 10
    • Sales order with reservation of 10
    • Warehouse item journal for a quantity of -7 (we need to scrap 7 pieces from stock)

    NOTE: At this stage, sales order will still be reserved against same 10 pieces when stock is not available

  • Microsoft Dynamics NAV Team Blog

    More How Do I Videos for Microsoft Dynamics NAV on MSDN

    • 2 Comments

    For your viewing and learning pleasure, a couple of new videos have been released and are available on MSDN. Check out the latest
    offerings:

    To see all offerings, click the link, http://msdn.microsoft.com/en-us/bb629407.aspx, and scroll to the Microsoft Dynamics NAV section.

    To keep up with the video releases, subscribe to the video feed: http://www.microsoft.com/feeds/msdn/en-us/videos/dynamics_NAV.xml

  • Microsoft Dynamics NAV Team Blog

    Reservations vs. costing application: should both be consistent?

    • 0 Comments

    Assume the following scenario:

    • We have a FIFO item where we set automatic reservation
    • We create a purchase with expected receipt on the 1st of October and another for the 15th of same month
    • We now create a sales order for the 1st of December

    Question here is: how NAV determines what is the purchase considered to create reservation against? Is costing method relevant here?

    First of all, let me explain you what is the role of the costing method. This defines how the cost flows through inventory postings. From this perspective, costing method only applies to ILEs. There wouldn't be any reason to consider an order (ie. purchase, sales) from a costing perspective: we are not sure that the order would finally be brought into stock since it can be cancelled. Also, ILE applications are created while posting the order (receipt, invoice). Thus, do not expect that costing method applies to orders ... unless they are bring into stock which mean it would apply ILE created following costing method.

    Based on the above parragraph, order reservation should not be constrained by costing method. Costing is only relevant for ILE application. Reserving an order does not mean an ILE would be created.

    Before going to the above specific scenario, the explanation I detailed above is just a standard business process. This is about what NAV is doing. This is about what a generic business process expect about what costing applies to and what reservations are constrained by.

    Now, our scenario. What NAV is doing (yes, NAV logic) is to reserve against the purchase with closest due date. Thus, it would reserve the sales order against the purchase on the 15th since this is the purchase with the closest receipt to the demand date. The idea on this logic is to reduce carryng cost. If NAV reserves against the first purchase order, it will increase the carrying costs and cost reduction is one of the premises in SCM philosophy.

    Most of the Partners believe that it should be reserved against the first one since there could other sales being created, let's say, for Dec 15th. In this case, the first purchase would be reserved against the second sales while the second purchase against the first sales. That s a mess. I agree. But, if you manually create the orders, why would you choose automatic reservations? If you manually create the orders, you are the one who was the logic about how those orders being created and what should be the most meaningful reservation. From a NAV perspective, the above scenario should result in reserving the sales with the second purchase order (again, reducing carrying cost) and that first purchase should be cancelled.

    In any case, if you still consider this logic should be changed, code where this logic is implemented can be found in CU99000845, function AutoReserveOneLine:

    IF
    Positive THEN BEGIN

    Search := '+';

    NextStep := -1;

    IF
    Item."Costing Method" = Item."Costing Method"::LIFO THEN
    BEGIN

    InvSearch := '+';

    InvNextStep := -1;

    ND
    ELSE BEGIN

    InvSearch := '-';

    InvNextStep := 1;
    END;

    END
    ELSE BEGIN
    Search := '-';
    NextStep := 1;
    InvSearch := '-';
    InvNextStep := 1;

    END;


    In here, it defines the string (‘+’ or ‘-‘) which will later be used with the FIND clause and will determine if the record retrieved is the first one (first purchase order) or the last.

     

  • Microsoft Dynamics NAV Team Blog

    Outlook Synchronization does not work correctly when multiple contacts have similar names stored in several address books in Microsoft Outlook and some other issues we found

    • 0 Comments

    It has been a while since I last wrote a blog posting about Outlook Synchronization in Microsoft Dynamics NAV. There is some news to mention which makes the configuration less complicated and some issues we found so far. In previous blog postings, in previous Microsoft Dynamics NAV releases and even in the official documentation about Outlook Synchronization, we used to suggest to synchronize the Microsoft Dynamics NAV salesperson  to Microsoft Outlook without the E-mail address. This was important to populate E-mail2 field with correct values in table 13 when working with Tasks and Appointments in a Microsoft Exchange Server environment. E-mail2 field no longer needs to be populated which means it is no longer required to synchronize the Microsoft Dynamics NAV salesperson without an E-mail address to Microsoft Outlook. You just create the salesperson in Microsoft Dynamics NAV with an E-mail address. After that you synchronize this salesperson to Microsoft Outlook and you are done. No further action is needed.

    Another issue we found is that when a Microsoft Dynamics NAV contact does also exist in one of the Microsoft Outlook address books, like the Microsoft Exchange Global Address List or any other custom Microsoft Outlook address book, an error could occur stating that the system was expecting an E-mail address matching the E-mail address it found in that other address book. The system should have looked in the dedicated contacts folders for Outlook Synchronization defined in the Outlook Add-In properties.

    A hot fix does exist for this issue and can be obtained from Microsoft:
    http://support.microsoft.com/kb/2617761

    Another problem may happen when working with several localized releases in one environment. E.g. in Belgium or in Switzerland, (Belgium) Dutch, (Belgium) France, Italian and German speakers may connect to the same company database. They can use their Microsoft Dynamics NAV language in the language they prefer. With Outlook Synchronization this could generate an issue, especially in the table 405 Change Log Entry. Let me further explain this via s small repro scenario.

    REPRO:
    1. install Microsoft Dynamics NAV 2009 SP1 (any build) or Microsoft Dynamics NAV 2009 R2 (any build), install French language pack or setup Suisse client with Suisse database
    2. configure Outlook Synch either via CFRONT or NST
    3. for the Outlook Synch user, only add company and person contact entity
    5. perform a normal synch
    6. for one of the synchronized contacts, update the address
    7. change language to French
    8. for the same synchronized contact, update the address again
    9. perform a normal synch

    ERROR:
    03.09.2010 09:11
    Fehler beim Ausführen einer Microsoft Dynamics NAV Codeunit für die Antwort: Kontakt Nr. 'KT000001' already exists.

    It's recommended that you have web services or NAS running in the language you're synchronizing against and have the users connecting setup in the same language.
    EN-US users are setup in an EN-US client and connects to an EN-US web service.
    FR-FR users are setup in an FR-FR client and connects to an FR-FR web service.
    DE-De users are setup in an DE-DE client and connects to an DE-DE web service.
    ..
    Etcetera

    The last issue we found is also a language related problem caused by a configuration issue. When configuring Outlook Synchronization in Microsoft Dynamics NAV for the first time, the configured language of the CSIDE Client or the configured language of the Role Tailored Client is extremely important. If you are working in a localized environment, the language of the CSIDE Client or Role Tailored Client will define the fields definition in the Outlook Synchronization tables. Changing language afterwards, will not change he pre-populated field. Let me explain with a screenshot using a Dutch localized Dynamics NAV 2009 R2 client using the APP entity.

    clip_image002

    If you generate the entities while CSIDE Client is set to Dutch in my scenario, the field changes to Dutch captions.

    clip_image002[6]

    Synchronizing any of this could result in an error in the Outlook Add-In:

    clip_image002[8]

    To solve this problem, the following is necessary:

    1. fix data issues in table 405 Change Log Entry or delete contents out of this table either via Object Designer or via Data Deletion after setting filters, etc.
    2. reset entities to default values after configuring the correct language in the CSIDE Client or Role Tailored Client matching language configuration of web services or NAS!)

    Regards,

    Marco Mels
    CSS EMEA

    This posting is provided "AS IS" with no warranties, and confers no rights

Page 1 of 1 (10 items)