Reference manual

Find Usages

Find Usages lists every place an object, field, procedure, variable, key or other declaration is used. The results open in the Usages window, grouped by object and by the procedure or trigger that holds each usage.

Starting Find Usages

  • Find Usages in the context menu of an object in the Object index, or of the object heading in the Object view.
  • Find Usages in the context menu of a declaration in the object view, such as a field, a procedure, a variable or a key.
  • Find all usages of this object…, Show where it uses this object… or Show where this object uses it… in the context menu of a row on the Dependencies tab.
  • Find Usages in the actions of a result in Universal Search: select the result and press Tab.
  • Search in the System Functions window.
  • Show details… on a relation in the Explore Table Relations window.
  • Find Usages in the context menu of a name in the Usages window itself: right-click the procedure, trigger or other declaration that holds a usage. It is disabled without a license and for declarations that Find Usages does not cover.

Without a license, the menu item reads Find Usages (Not enabled in this edition) and is disabled.

The Usages window

Prism for C/AL Usages window with the usages of a field and the filter panel open
1 2 3 4 5 6 7 8 9 10
The usages of a field, with the filter panel open.
#NameDescription
1QueryWhat was searched: select all direct usages of the target, and in the object searched when there is one. For system functions it reads select the functions applied to the object.
2SearchKeeps the usages whose code line contains the text, ignoring case.
3Shown usagesCurrently displaying all (N) usages, or Currently displaying X of N usages in the accent color when the search or a filter hides some.
4Toggle filter panelShows or hides the filter panel (Ctrl+O). Enabled for the usages of a field and for system functions on a record.
5Collapse allCollapses every node.
6Expand allExpands every node.
7CopyCopies the shown usages. See Share usages with a colleague.
8Pinned rowsThe object and declaration of the top usage stay pinned at the top while you scroll. Pinned rows expand and collapse like the rows below them.
9UsageThe code line with the usage, under its object and the procedure or trigger that holds it. Select it to go to the usage in the workspace window.
10Filter panelNarrows the usages of a field, or of system functions on a record. See Field filter and Temporary record filter.

Each usage shows the path to it, from its object down to its code line. Right-click a step of the path: Navigate goes to that step, and Toggle detail switches the path between a one-line trail and the full indented path. The results of Code Lines and Text Constants show their paths the same way.

Field filter

Prism for C/AL Usages window filter panel with the field filter and its include options
1 2 3 4
The field filter, with Show where assigned and read chosen.
#NameDescription
1Show where assigned and readLists every usage of the field, with the include options below it.
2Save as defaultSaves the include options as your default for assigned and read.
3Include optionsWhat the list takes in besides code; see the table below.
4Show where assigned onlyLists only where the field is given a value, with its own include options and save button.

For the usages of a field, the filter panel chooses between all usages and assignments only. Each choice has its own include options, all checked by default. The save button beside each choice keeps its current options as your default for the next search.

OptionUnderIncludes
Include PropertiesAssigned and readUsages in properties.
Include Key DefinitionsAssigned and readKeys that contain the field.
Include TransferFieldsBothTRANSFERFIELDS calls on the field's table.
Include Clear(Record|Field)BothCLEAR of the record or of the field.
Include Message|Confirm|Error parametersAssigned and readThe field passed to MESSAGE, CONFIRM or ERROR.

Temporary record filter

When you find the usages of system functions such as INSERT or DELETE on a table, the filter panel tells temporary records from physical ones. Physical means a record declaration that is not temporary.

Prism for C/AL Usages window with the temporary record filter
1 2 3
Usages of DELETE and DELETEALL on a table, with the temporary record filter.
#NameDescription
1Show all usages (temporary and physical)Lists every usage. The default.
2Zoom in on physical usagesLeaves out usages on temporary records. Physical global and local variables and physical by-value parameters are always included.
3Usages of by-reference parametersWith Zoom in on physical usages: Include all (whether declared physical or temporary) (the default) or Only include if declared physical.

A by-reference (VAR) parameter declared TEMPORARY can still be passed a physical record: C/AL does not enforce the declaration. Keep Include all to be sure no physical usage is left out.

A record counts as temporary when:

  • It is declared TEMPORARY.
  • It is the own record (Rec, xRec, or a bare call such as INSERT) of a page or form with SourceTableTemporary=Yes. A record variable over the same table without TEMPORARY stays physical.
  • It is a report data item or an XMLport table element with UseTemporary=Yes.

What is found

Besides code, Find Usages reads the places C/AL names a declaration outside code:

WhereWhat is found
Report DataItemLinkThe field on the left as a field of the data item's own table, and each FIELD(…) as a field of the data item it links to: the one DataItemLinkReference names, otherwise the nearest enclosing data item. Query DataItemLink and XMLport LinkFields are not searched.
View and link propertiesFields in properties such as RunPageView, RunPageLink, SourceTableView, SubPageLink, DataItemTableView, RunFormView, RunFormLink, SubFormView and SubFormLink.
Event subscribersFind Usages on a subscriber lists the publisher it subscribes to: the publisher procedure, or for a validate event the field it names. A subscriber to a record event such as OnAfterInsertEvent lists no publisher.
Field usages and validate eventsThe usages of a field include the OnBeforeValidateEvent and OnAfterValidateEvent subscribers that name it.
XMLport node namesFind Usages on an XMLport text element, attribute or table element lists where code uses it.

Find where a field is written

Use this when a field holds a value you did not expect and you need the code that sets it.

  1. Open the table in the object view and right-click the field.
  2. Choose Find Usages. The Usages window opens.
  3. Press Ctrl+O to open the filter panel.
  4. Choose Show where assigned only. Clear Include TransferFields and Include Clear(Record|Field) to see only direct assignments.
  5. Select each usage to read it in context.

The window lists the assignments only; the count at the top tells how many of all usages they are.

Share usages with a colleague

Use this to hand a list of usages to a colleague or keep it in a spreadsheet.

  1. Narrow the list with the search box and the filter panel until it shows what you want to share.
  2. Select the copy button.
  3. Paste into a spreadsheet or a message.

The copy holds the usages the window shows, as tab-separated text with the columns Object, Context and Code.

Behavior

  • Background search: the search runs as a background task. When it finds nothing, a notification says No usages found and no window opens.
  • Window title: names the target and the count, such as Usages (Customer) | 214 usages, after the product name.
  • Navigation: selecting a usage goes to it at once; double-clicking does the same.