Many questions in Microsoft forum about this topic: “How to generate new dimension ID from data (dimensions values for NAV login) existing on external tables ?”
Use standard NAV to achieve this, you can use standard NAV function DimMgt.GetDimensionSetID(Rec) to create New Dimension SET ID of function existing on UpgradeToolkit since NAV 2013.