/trud-d365fo-xpp:d365-xpp-trace-parserfrom D365FO X++ Development
Queries a Dynamics 365 Finance & Operations Trace Parser SQL database to find which X++ method and SQL statement wrote a specific field value, including bind values and call stacks. Use when investigating record changes, batch jobs, or trace data.
Ships in D365FO X++ Development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Trace Parser imports a trace into an ordinary SQL Server database: every X++ call and every SQL statement, and, when the trace was captured with SQL parameter values, the actual values each statement bound. The Trace Parser UI shows timelines and call trees, but questions like "which code set WorkTemplateCode on this record?" mean digging through millions of lines by hand. Querying the database answers them in seconds: find the statement that wrote the value, then its X++ call stack, then read those methods in the source.
The scripts are read-only and work on a development VM, a cloud-hosted Tier1, or any SQL Server that holds the imported trace. Microsoft's Trace Parser agent (Copilot Studio plus a Data API Builder server over the same schema) isn't needed for this.
-Database.PackagesLocalDirectory), because the trace gives method names, not code.Get-TraceSession.ps1 lists the traces; with -TraceId it lists sessions and the busiest threads with their main call. A batch job, wave or posting usually runs in one thread whose main call is a BatchRun method.Find-TraceSql.ps1 -TraceId N -Table WHSWORKTABLE lists its statements; add -Operation Insert -Columns WORKID,WORKTEMPLATECODE -Filter 'WORKID=WORK-000123' to see each call with its values.Find-TraceValue.ps1 -TraceId N -Value 'WORK-000123' finds every table and column it was bound to, in time order. It also shows values written to temporary or staging tables first (*TMP* tables), which is often where the decision was made.RECID (and RECVERSION), not the business key. Get the record's RecId from its insert (-Columns WORKID,RECID), then find every change with Find-TraceValue.ps1 -Value <RecId> -Operation Write or Find-TraceSql.ps1 -Operation Update -Columns FROZEN,RECID -Filter 'RECID=<RecId>'.
Both scripts return a TraceLineId per call.Get-TraceCallStack.ps1 -TraceLineId <id>. Read the confirmed chain from the bottom up: the statement, the table method (insert, update), and the business methods that called it.Find-TraceMethod.ps1 -TraceId N -Thread T -Name 'WhsWorkCreate::*' lists a class's methods in the order they first ran, with call counts. Loops show up as high counts between two sequence numbers. -Calls lists each call of one method with its TraceLineId, for its own call stack.PackagesLocalDirectory\<Package>\<Model>\AxClass\<Class>.xml (and the matching extensions; the d365-xpp-xref skill finds callers and extension classes). Find the line that assigns the field, and match each condition in the code with the values the trace shows.All scripts are in <skill-dir>\scripts\ (Windows PowerShell 5.1, SELECT-only, Windows authentication). Common parameters: -Server (default .), -Database (default: auto-detected), -TimeoutSeconds. Output is a summary line plus tab-separated rows. Exit codes: 0 rows found, 1 nothing found, 2 setup or connection failure.
| Script | What it answers |
|---|---|
Get-TraceSession.ps1 [-TraceId N] [-Top 20] | Which traces are imported; for one trace, its sessions and its busiest threads (Thread = UserSessionProcessThreadId, used by the other scripts) with their main X++ call and duration. |
Find-TraceSql.ps1 -TraceId N -Table T [-Operation Write|Insert|Update|Delete|Select|Any] [-Columns A,B | *] [-Filter 'A=v;B=x*'] [-Thread T] [-StatementHash H] [-Top 500] | Without -Columns: the statements on a table with call counts. With -Columns: every call with the bound values of those columns; * prints all parameters as NAME=value. |
Find-TraceValue.ps1 -TraceId N -Value 'X' [-Operation Any|Write|...] [-Thread T] | Where a value (exact, or * pattern) was bound: operation, table, column, calls, threads, first sequence and first TraceLineId. |
Get-TraceCallStack.ps1 -TraceLineId L [-ExcludeMethod 'A*','B::*'] | The X++ call stack of a statement or method call, outermost first. |
Find-TraceMethod.ps1 -TraceId N -Name 'Class::*' [-Thread T] [-ExcludeName '*::parm*'] [-Calls] [-Top 300] | Methods matching a pattern in first-run order, with calls, first/last sequence and total time; -Calls lists each call. |
From Bash, run them as powershell.exe -NoProfile -ExecutionPolicy Bypass -File "<skill-dir>/scripts/<Script>.ps1" ...; list parameters can then be passed as one comma-separated string (-Columns 'WORKID,WAVEID').
For a question the scripts don't cover (for example everything that ran between two sequence numbers, or the slowest statements of a thread), read references/trace-schema.md and query the database directly.
Find-TraceSql value columns: - means the statement doesn't bind that column (it may be a literal in the SQL text); an empty value means it's bound but empty. Statements that don't bind a -Filter column are skipped, so -Filter 'COL=*' keeps only statements that set COL.? placeholders. INSERT ... VALUES uses the column list; INSERT ... SELECT (insert_recordset) maps the n-th SELECT item to the n-th insert column; everything else uses the column compared with the ? (SET STATUS=?, WHERE T1.ITEMID=?). A repeated column becomes COLUMN#2 (for example RECVERSION in SET and RECVERSION#2 in WHERE), and an aliased one is also available as T2.COLUMN. Op marked ! means the call captured a different number of values than the statement has placeholders; don't trust its mapping.Get-TraceCallStack confirmed chain: every frame is the caller of the next, proven by the trace's parent links. Repeated kernel frames (such as PropertyChange) are printed once with a count.Get-TraceCallStack unconfirmed part: when the parent chain breaks (see Gotchas), the script lists the calls that enclose the top of the confirmed chain. The real callers are among them, but so are calls that had already returned. Names that occur 3 or more times are collapsed into one line. Decide the real caller from the X++ source and from the call order (Find-TraceMethod).TraceLines.TimeStamp is a Windows FILETIME (100-ns ticks, UTC), and the *DurationNano columns use the same 100-ns unit: InclusiveDurationNano equals TimeStampEnd - TimeStamp. The scripts convert to milliseconds (InclMs, TotalMs). SQL views that divide by 1,000,000 show times 10 times too small. If a duration matters, sanity-check it against something with a known length, such as the batch job's run time.Sequence is trace-wide. It's unique in the whole trace and follows time across threads, so FirstSeq orders events from different threads. UserSessions is keyed by (SessionId, TraceId): session numbers repeat in every trace in the database, so always filter by trace.ReqReaderWriterLock..., used by wave processing, MRP and other parallel batch work) and finalizers (Connection::finalize) are recorded inside the same thread. After the first lock, the parent links of later calls can point into those frames, so the confirmed chain may be only the last few frames, and calls that already returned look open. Pass extra noise patterns with -ExcludeMethod if a lock helper of your feature floods the list, and confirm the callers in the source.DATAAREAID, PARTITION and constants into the SQL text as literals; Find-TraceValue can't find those. Enums appear as their integer value; dates as the date part only.TEMPDB."DBO".T12345<SERVER>_<session>_<guid>: pass -Table 'TEMPDB."DBO".T12345*'. In-memory temporary tables never reach SQL, so they aren't in the trace at all; tables named ...Tmp... that are regular tables are traced normally.CallTypeId = 64 and carry the bind values; X++ methods are CallTypeId = 8. The X++ method that issued a statement also carries its statement hash, so don't count both when you count executions.-Thread, -Operation, -Filter and -Top rather than printing everything.references/trace-schema.md (opens in a new tab)scripts/Find-TraceMethod.ps1 (opens in a new tab)scripts/Find-TraceSql.ps1 (opens in a new tab)scripts/Find-TraceValue.ps1 (opens in a new tab)scripts/Get-TraceCallStack.ps1 (opens in a new tab)scripts/Get-TraceSession.ps1 (opens in a new tab)scripts/TraceCommon.ps1 (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub trudax/d365fo-xpp-skills --plugin trud-d365fo-xpp5 skills in this plugin
/d365-xpp-compileSet up the task's Visual Studio project and git branch, then build a Dynamics 365 Finance & Operations (D365 F&O, AX7) X++ project (.rnrproj) from the command line the way Visual Studio does on a development VM (CHE or VHD) - compile its package with xppc into PackagesLocalDirectory, compile labels, sync changed tables and data entities, restart the AOS so the change can be tested - and analyse the compile errors. Use this at the start of every task that will create or modify X++ / AOT elements (AxClass, AxTable, AxForm, table/form/class extensions, EDTs, enums, menu items, data entities, security, labels), before the first edit - to create or find the task's project and branch - and after the changes - add the changed elements to the project, build, and fix errors until the build is clean, without waiting to be asked. Also use when the user says "build/compile the project", "deploy it so I can test", "check that it compiles", "run xppc", or pastes X++ compiler errors./d365-xpp-conventionsConventions for creating Dynamics 365 Finance & Operations (D365 F&O, AX7) X++ elements as metadata XML - new tables and table fields, EDTs, table relations, setup forms (simple list, list and details with a tabular grid), RunBase dialog and batch classes, table/form/enum extensions, Chain of Command and event handler classes, menu items and security privileges. Use this before writing the XML whenever you create a table, add fields to a table or table extension, create a form, an extension or extension class, a RunBase/RunBaseBatch class or other periodic operation, a menu item or a privilege - even when the user only says "create a table for X", "add a field", or "make a job that updates Y"./d365-xpp-extensionsRules and recipes for extending standard Dynamics 365 Finance & Operations (D365 F&O, AX7) X++ code from your own model - Chain of Command wrappers ([ExtensionOf], next), pre/post, data-event and form event handlers, delegate subscribers, form, data source and control extensions, lookups (control, field, reference group, multi-select) and fields added to RunBase or SysOperation dialogs. Use this before writing or reviewing any [ExtensionOf] class or event handler class, and whenever the task changes, blocks or adds to standard behaviour - "add a check before posting", "default this field on the sales line", "filter this lookup", "add a field to this dialog", "hide this button on the form", "why is my extension not called", "review this extension" - even when the user doesn't say Chain of Command, CoC or extension./d365-xpp-xrefFind where a Dynamics 365 Finance & Operations (D365 F&O, AX7) X++ element is used by querying the cross-reference database (DYNAMICSXREFDB) instead of searching source files. Use this when the user asks "where is X used", "who calls method Y", "which classes use SalesLine.SalesPrice", "find references", "find all usages", "what extends/implements class Z", "which methods have attribute A", or wants an impact analysis before changing a table field, method, EDT, enum, or class - especially across large models such as ApplicationSuite, where grepping XML is slow and token-heavy. Also use it before writing a Chain of Command extension, to find the existing [ExtensionOf] class of that class, table or form in the user's model and add the new method there instead of creating another extension class.