3

Is there any way I can find labels which are not used in D365 FO (labels which dont have references)?

FH-Inway
  • 4,432
  • 1
  • 20
  • 37
andjelalj
  • 31
  • 1

1 Answers1

3

The cross references are stored in database DYNAMICSXREFDB. You can use a query to generate a list of labels that have no references.

This query uses two tables in the database:

  • Names holds an entry for each object in the application that can be referenced.
    • The Path field of the table holds the name of the object (e.g. /Labels/@FormRunConfiguration:ViewDefaultLabel is the path of the ViewDefaultLabel in the FormRunConfiguration label file.
    • Field Id is used to reference a record in this table in other tables.
  • References holds the actual references that connect the objects.
    • Field SourceId contains the Id of the Names record of the object that references another object identified by field TargetId.

The actual query could look like this:

SELECT LabelObjects.Path AS UnusedLabel 
FROM [dbo].[Names] AS LabelObjects
WHERE LabelObjects.Path LIKE '/Labels/%' 
AND NOT EXISTS 
    (SELECT * 
        FROM [dbo].[References] AS LabelReferences 
        WHERE LabelReferences.TargetId = LabelObjects.Id)

Make sure to compile the application to update the cross reference data. Otherwise the query might give you wrong results. When I run this query on a version 10.0.3 PU27 environment, it returns one standard label as a result.

ResultOfQueryForUnusedLabels

FH-Inway
  • 4,432
  • 1
  • 20
  • 37