Thursday, December 21, 2017

Dynamics NAV - Intercompany - The General Journal Template already exists

This can happen when copying companies for intercompany setup.

When selecting Sales Journals Page, you get this error


Navigate to General Journal Templates
Delete the template producing the error

Wednesday, December 20, 2017

Dynamics NAV - Message: An item with the same key has already been added.

Problem:
This error occurs after a separate NAS service has been started.
The service itself runs, but the window error log shows this error, and the NAS does not execute any scheduled tasks.



Solution:
Google has Vague descriptions about problems with duplicate language codes, or duplicate keys in tables.

It may have to do with sql security after restoring a db to a new sql server that has the same user accounts, but in caps or commons.
Remove all users from the db and re-add them to ensure the security on the db corresponds to the actual users on the machine.

Set SQL to run as the same account the NAV Instance is running under
Ensure the account is a member of db_owner in the company db

Run the Fix Orphan Script
---------------------------------------------------
SET NOCOUNT ON
USE AdventureWorks
GO
DECLARE @loop INT
DECLARE @USER sysname
DECLARE @sqlcmd NVARCHAR(500) = ''

IF OBJECT_ID('tempdb..#Orphaned') IS NOT NULL
 BEGIN
  DROP TABLE #orphaned
 END

CREATE TABLE #Orphaned (UserName sysname,IDENT INT IDENTITY(1,1))

INSERT INTO #Orphaned (UserName)
SELECT [name] FROM sys.database_principals WHERE [type] IN ('U','S') AND is_fixed_role = 0 AND [Name] NOT IN ('dbo','guest','sys','INFORMATION_SCHEMA')

IF(SELECT COUNT(*) FROM #Orphaned) > 0
BEGIN
 SET @loop = 1
 WHILE @loop <= (SELECT MAX(IDENT) FROM #Orphaned)
  BEGIN
    SET @USER = (SELECT UserName FROM #Orphaned WHERE IDENT = @loop)
    IF(SELECT COUNT(*) FROM sys.server_principals WHERE [Name] = @USER) <= 0
     BEGIN
        IF EXISTS(SELECT 1 FROM sys.database_principals WHERE [Name] = @USER AND type_desc = 'WINDOWS_USER')
         BEGIN
            SET @sqlcmd = 'CREATE LOGIN [' + @USER + '] FROM WINDOWS'
            Exec(@sqlcmd)
            PRINT @sqlcmd
         END
        IF EXISTS(SELECT 1 FROM sys.database_principals WHERE [Name] = @USER AND type_desc = 'SQL_USER')
         BEGIN
            SET @sqlcmd = 'CREATE LOGIN [' + @USER + '] WITH PASSWORD = N''password'''
            Exec(@sqlcmd)
            PRINT @sqlcmd
         END
     END
   
    SET @sqlcmd = 'ALTER USER [' + @USER + '] WITH LOGIN = [' + @USER + ']'
    Exec(@sqlcmd)
    PRINT @USER + ' link to DB user reset';
    SET @loop = @loop + 1
  END
END
SET NOCOUNT OFF
------------------------------------------------------------

Monday, December 18, 2017

Dynamics GP - Printing to File - Selecting DOCX but only getting HTM in file location

Word Form Template for this report does not exist.

Create a word form template for this report using the correct original or modified version.
Create it from existing report, not blank.

Saturday, December 16, 2017

Dynamics NAV - Setup Flow Fields


  • Go to Table
  • Create new field
  • Click properties
    • Switch Fieldclass to Flowfield
    • Use Lookup if you just need to get a value from a related table eg. Barcode, Shipment No.
    • Set Calcformula to your formula
    • Set editable to no
  • These fields are available and sortable in pages

Friday, December 15, 2017

Dynamics NAV - Item Attributes vs LS Retail Attributes


  • LS Retail has an Attributes list that can be used to add multiple attributes to an Item, Customer, Vendor
    • These can also be displayed on the POS
    • Can be selected as a Hard Attribute on the Retail Item Card
    • Will be passed on to LS OMNI, and will be visible when requesting items
  • NAV also has an Item Attributes
    • These can be assigned directly to items, or to item categories
    • The values will be displayed in the Item Attribute factbox in the item list

Dynamics NAV - Configuration Templates

These can be used to set default values for Items, Customers, Vendors, Etc.

Item Category now has an Item Template Code field

Item Categories can also have their own attributes using the Item Categories page from Financials

  • Create Config Template that matches your item categories
  • Set all default values that should be populated on the Config Template
  • Assign Config Template to Item Category
  • When Item Category is used, all default values will be applied
  • Item Categories can have parent categories
    • Parent categories are existing categories in the item category table
    • Child categories inherit all attributes from parent categories
    • This allows for a complex hierarchy structure to be setup for Parent categories and regular categories

Wednesday, December 13, 2017

Dynamics NAV - Image previews do not display after importing image link records

This is because a Media Set ID is calculated in the Tenant Media Set table for each database as whenever a picture file is physically imported.

You must re-import all pictures, or write a codeunit to insert the new media set index values into the Tenant Media Set table of the new db.

Tuesday, December 12, 2017

SQL - Count All Rows in All Tables

SELECT T.name AS [TABLE NAME],
       I.rows AS [ROWCOUNT]
FROM   sys.tables AS T
       INNER JOIN sys.sysindexes AS I
               ON T.object_id = I.id
                  AND I.indid < 2
--WHERE T.name like 'Cronus%'
ORDER  BY I.rows DESC

Saturday, December 2, 2017

Management Reporter - Crashes when trying to import Building Blocks

The screen itself is bugged, do not mouseover anything on the screen
Use the keyboard to tab and arrow to navigate, and crtl+a to select everything, then tab down to import and hit enter

Friday, December 1, 2017

Dynamics GP - SSRS - Migrate SSRS Objects to new Server