Wednesday, November 5, 2014

Add New User to Dynamics NAV 2013 from SQL Server

Add New User to Dynamics NAV 2013 from SQL Server


STEP 1 - GET Windows Security ID or SSID


Run the script in  POWER Shell ISE to get SSID

$winUser = New-Object System.Security.Principal.NTAccount("YourDomain\Your ID")
$sysSID = $winUser.Translate([System.Security.Principal.SecurityIdentifier])
$sysSID.Value




STEP 2 - ENTER USER information into NAV Database with NAV Roles.


Run the script in SQL Server (SSMS)

USE [NAV DATABASE]

DECLARE @winUserSID uniqueidentifier, @WinUserSID nvarchar(119),
                    @navuserName, nvarchar(50), @txtUSERSID varchar(50)

 SELECT NEWID()

 SET @navuserName   = 'Domain\user'
 SET @WinUserSID    = NEWID()
 SET @txtUSERSID = CONVERT(VARCHAR(50), @winUSERSID)
 SET @WINSSID = 'copy from Powershell_value'
 INSERT INTO [dbo].[User]
      ([User Security ID],[User Name],[Full Name],[State],
        [Expiry Date],[Windows Security ID],[Change Password], 
        [License Type],[Authentication Email])
VALUES
     (@winUserSID,@navuserNAME,'',0,'1753-01-01 00:00:00.000',@WINSSID,0,0,'')

 INSERT INTO [dbo].[User Property]
      ([User Security ID],[Password],[Name Identifier],[Authentication Key],
        [WebServices Key],[WebServices Key Expiry Date],[Authentication Object ID])
 VALUES
      (@winUserSID,'','','','','1753-01-01 00:00:00.000','')

 INSERT INTO [dbo].[Access Control]
           ([User Security ID],[Role ID],[Company Name])
     VALUES
           (@winUserSID,'SUPER','')

 GO



Comments/Uncomment – Dynamics NAV 2015 -Development Feature

 

Comments/Uncomment – Dynamics NAV 2015

New Development feature in Microsoft Dynamics NAV 2015 is able to comment block of code. like .NET.


Example:

To comment:    

            Select block of the code that you like to comment,Then Goto EDIT ->Comment Seletion or Shift+Ctrl+K

 

To Remove:  Goto EDIT ->Uncomment Seletion or Shift+Ctrl+O