Metadata search in Visual Studio
Metadata search in Visual Studio
This article describes how to use metadata search to search your code and metadata for arbitrary patterns and content.
Given the large volume of the code base and metadata, it is often necessary to find things in the code that meet a certain criteria. For example, you might not know the name of the metadata element that contains the pattern or meets the criteria. Metadata search is exposed in Visual Studio through two user interfaces: the Metadata Search tool window and the Navigate To window.
Metadata search tool window
You can access the Metadata search tool window from the Dynamics 365 > Metadata Search menu command. Enter your search query to start the search. Results will start populating in the window asynchronously as you type. You can double-click any result line to navigate to the corresponding X++ code or metadata that matches your search query.
You can also select one or more results, right-click, and then add these elements to a project. You don’t need to wait for the search to complete before you start interacting with the search results.
Navigate To window
The Navigate To window is invoked using the Ctrl+‘,’ (the comma character) shortcut keys. Pressing Ctrl+‘,’ displays the query entry box in top-right corner of the Visual Studio main document window. You can also access the Navigate To window from the Visual Studio Edit menu. Enter you search query and see the results appear as you type. A progress indicator will stop when the search is complete. You don’t need to wait for the search to complete to start interacting with the results.
Search query syntax
This section describes the search query syntax and provides example queries.
The search query is a search string that consists of a set of filters in this general form:
<filter_i> is one of the acceptable filter names, and <
filter_i_value> are comma separated (and possibly quoted) filtering values.
Name: Filter by element name. This is the default filter, meaning if you just type a filter value, it is assumed to be an element name. Each comma-separated value is an acceptable element name.
Type: Filter by element type. Each comma-separated value should be the name of an element or subelement type (root type or subtype) (that is, table, class, field). Logic of filtering is:
(roottype_1 OR roottype_2 OR … OR roottype_N) AND (subtype_1 OR subtype_2 OR … OR subtype_N)
Model: Filter by model name. Each comma-separated value should be the name of a model in your application.
Property: Apply property filters. Each comma-separated value should be in the form
Code: Filter using code snippets, use quotes around code snippets. The matching source code is the elements that contain the specified code snippet.
You can get help about using filter and filter syntax by opening the drop-down menu available in the search box.
|Query string||What it does|
|If the token is by itself, it is assumed to be the name. So this will find everything in the application that has “TrvExpTable” in the name.|
|Finds all forms that have “ccount” in their names.|
|Finds all forms that contain the property “FormTemplate” equal to ‘ListPage’.|
|Finds formDesign nodes under tables, nothing would be found.|
|Finds all menu function button controls with the Text property equal to (a label) ‘@SYS311998’.|
|Finds tables with a method containing “insert” in the method name.|
|Finds tables with an index name containing the word “Export”.|
|Finds table indexes with “xpNum” in the index field name.|
|Finds FieldGroups (in tables) containing ‘EPNew’ in their names.|
|Finds form grid controls, with properties allowedit equal to “no” and heightmode equal to “column”.|
|Finds form tab controls, with properties arrangeMethod equal to “Vertical” and ViewEditMode equal to “view” and WidthMode equal to “Auto”.|
|Finds all forms with the “WorkflowDataSource” property in the FormDesign node set to the value “TrvExpTable”.|
|Find all forms in Application Suite model that has the style property set to simpleListDetail in the FormDesign node.|
|Finds all places in the source code that contains “return null”.|
|Finds all places in the forms source code that contain the snippet “element.lock()”.|
|Finds all places in the source code of either forms or tables that contain “insert”.|
|Finds all form methods that contain the code “public display”.|
|Finds all form Button Controls that have empty text properties.|