Validate Windows Authentication

Below mentioned two lines of code will help you to validate windows user id from your NAV perspective. Cheers all!!, keep exploring the enormous possibilities with DotNet variable.

PrincipalContext@1002 : DotNet "'System.DirectoryServices.AccountManagement, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.DirectoryServices.AccountManagement.PrincipalContext";
ContextType@1001 : DotNet "'System.DirectoryServices.AccountManagement, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.DirectoryServices.AccountManagement.ContextType";

PrincipalContext := PrincipalContext.PrincipalContext(ContextType.Domain);
Valid := PrincipalContext.ValidateCredentials(vUserID,vPassword);

NAV 2016 Ready!!!

Good News!!!  NAV 2016 baby has been arrived.

Download here!

Header

System Requirements for Microsoft Dynamics NAV 2016

what excites me the most are the

  • New CAL editor with intellisense feature

intels3

  • Code Coverage is back to NAV

CodeCoverage

  • Posting Preview feature

pp

  • NAV app for smartphone literally The Universal app

itunes

  • Lots and Lots of enhancements to webclient, like change company

Change comp

Customer/Vendor ledger entry wrong Amount, Remaining Amount in NAV 2015

It has been noted as a  bug in NAV 2015 where Customer/Vendor Ledger Amount, Amount(LCY), Remaining Amount and Remaining Amount(LCY) flowfields are calculated wrongly. This case only if there is adjustments posted for foreign currencies.

With NAV 2015 you might have noted that these flowfield calculation formula is bit different.

Vendor Ledger entry Amount(LCY) flowfield calculation in

Older than NAV 2015 version

Sum(“Detailed Vendor Ledg. Entry”.”Amount (LCY)”WHERE (Vendor Ledger Entry No.=FIELD(Entry No.),Entry Type=FILTER(Initial Entry|Unrealized Loss|Unrealized Gain|Realized Loss|Realized Gain|Payment                 Discount|’Payment Discount (VAT Excl.)’|’Payment Discount (VAT Adjustment)’|Payment Tolerance|Payment Discount     Tolerance|’Payment Tolerance (VAT Excl.)’|’Payment Tolerance (VAT Adjustment)’|’Payment Discount Tolerance (VAT Excl.)’|’Payment Discount Tolerance (VAT Adjustment)’),Posting Date=FIELD(Date Filter)))

NAV 2015

Sum(“Detailed Vendor Ledg. Entry”.”Amount (LCY)” WHERE (Ledger Entry Amount=CONST(Yes),Vendor Ledger Entry No.=FIELD(Entry No.),Posting Date=FIELD(Date Filter)))

With NAV 2015, Microsoft added a new field in Detailed Customer/Vendor Ledger entry tables,Field ID – 43 “Ledger Entry Amount” (Boolean). This field is updated on onInsert of Detailed Cust. Ledg. Entry and Detailed Vendor Ledg. Entry. Except for entry type “Application” or “Appln. Rounding”, this new fields is updated true.

But then posting Exchange rate adjustments this new field is not getting updated, even through entry type for the exchange rate adjustment entries will be one of these, Unrealized Loss,Unrealized Gain,Realized Loss,Realized Gain.

To Fix this wrong calculation

  • Amend Report 595 – Adjust Exchange Rates. Function – HandlePostAdjmt

Search for DtldCustLedgEntry.INSERT; replace it as DtldCustLedgEntry.INSERT(true);

Search for DtldVendLedgEntry.INSERT; replace it as DtldVendLedgEntry.INSERT(true);

Capture

  • Patch Ledger Entry Amount field in existing Detailed Ledger records

Kill Sessions – Life saving script

Some of you have come across hard times when database keep not responding when doing SQL server restart, while alter database settings, while changing Single/Multi user settings…. etc

This script can be used to find blocking sessions.

Once blocking session is identified, analyse carefully and KILL the particular session id.

This small script saved my life many times,so its here for you… Cheers!!

select
 l.resource_type,
 l.request_mode,
 l.request_status,
 l.request_session_id,
 r.command,
 r.status,
 r.blocking_session_id,
 r.wait_type,
 r.wait_time,
 r.wait_resource,
 request_sql_text = st.text,
 s.program_name,
 most_recent_sql_text = stc.text
 from sys.dm_tran_locks l
 left join sys.dm_exec_requests r
 on l.request_session_id = r.session_id
 left join sys.dm_exec_sessions s
 on l.request_session_id = s.session_id
 left join sys.dm_exec_connections c
 on s.session_id = c.session_id
 outer apply sys.dm_exec_sql_text(r.sql_handle) st
 outer apply sys.dm_exec_sql_text(c.most_recent_sql_handle) stc
 where l.resource_database_id = db_id('DatabaseName')
 order by request_session_id;