domain-modeling
Write a glossary, record ADRs, and clarify vague terms.
MAmattpocock/skills336k4,217 new stars in the last 7 days
Build, explain, or troubleshoot Dataverse FetchXML queries from business requirements and verified table metadata. Use when asked to write a FetchXML query, join Dataverse tables, aggregate Dataverse rows, or fix missing or duplicate FetchXML results.
Turn a business question into a schema-grounded FetchXML query and explain exactly what each result row represents.
Reuse information already supplied or available in the workspace. If the user doesn't provide all details upfront, ask for the missing ones before proceeding. Ask only for information needed for the requested query, and do not ask for credentials in chat.
Produce the query inline or save <query-name>.fetchxml when a file is requested. Accompany it with:
Map each business term to a logical name and data type. Verify relationship direction, primary keys, lookup targets, and choice/state values. Resolve Web API entity-set names from metadata rather than pluralizing logical names.
For live discovery, request only the relevant EntityDefinitions, Attributes, and relationship metadata. Local exports may omit system components; absence from an export does not prove absence from the environment. Treat names found only in examples as illustrative until verified for the user's environment.
Clarify ambiguous relationship questions: “accounts with no contacts” differs from “accounts without a primary contact.” Clarify relative-date boundaries, time zone, and DateOnly versus UserLocal behavior when these change the result.
Choose the root table and minimal output columns. Decide whether related tables supply output columns, restrict existence, or identify missing matches.
A one-to-many join can multiply parent rows. Explain that effect and choose an existence pattern when only membership matters. Do not add distinct just to conceal an incorrect join; if distinct output is requested, discuss how selected columns define uniqueness and explicitly select identifiers when needed.
For aggregates, distinguish row count from non-null column count and distinct column count. Every selected aggregate column needs an alias and either an aggregate or group-by role. Explain how joins can inflate totals. Do not add ungrouped primary keys to aggregate output.
Use one fetch root and one root entity. Use explicit attributes and nested and/or filters reflecting the requested logic.
link-entity, from belongs to the linked table and to belongs to its immediate parent. Set explicit aliases when filters or output refer to a link.operator="null". A null test inside the link does not express the same condition.entityname. Place each predicate according to the intended semantics.value elements for multi-value operators; null operators take no value. Use verified numeric choice values rather than labels.top; for paging use count and page, without top. Choose deterministic ordering with a unique tie-breaker for ordinary row queries. Aggregate and distinct queries need ordering appropriate to their result grain.Consult the Microsoft reference for unfamiliar operators or link types rather than guessing supported syntax.
Parse generated XML using an available XML parser, then check referenced schema, aliases, filter nesting, aggregate roles, and the intended result grain. XML well-formedness alone is not FetchXML schema or Dataverse validation.
When live testing is requested and an authenticated environment is available, run bounded read-only queries. Use a small preview or a known test subset. For aggregate tests, constrain the input population; limiting output groups does not bound rows scanned.
Compare results with an independent expectation: a known fixture, equivalent query, or per-record relationship checks. Empty results prove neither positive nor negative semantics. Report cases with insufficient data as inconclusive.
For missing rows, inspect inner joins, post-join filters, null values, identity-dependent filters, and the caller's access. For duplicates, inspect relationship cardinality and projected columns before changing distinctness. Do not promise that a static rewrite improves performance without measuring it.
Provide raw XML by default. For Power Automate, explain placement in Dataverse List rows' Fetch Xml Query input. For Web API, URL-encode the completed XML once into the fetchXml query parameter on the verified entity set. For SDK use FetchExpression; for PAC CLI consult installed pac env fetch --help before constructing commands.
If multiple pages are required, use the server's paging cookie when available and increment the page number; serialize the cookie as XML attribute data rather than concatenating unescaped text. Some query shapes do not return cookies. Explain the applicable paging limitations instead of treating one page as the complete dataset.
Record exactly which validation levels passed. Keep proposed fixes separate from observed server behavior.
Input: Return at most 10 active accounts with no contacts linked through contact.parentcustomerid. Return account ID and name. Supplied schema confirms account(accountid, name, statecode), contact(contactid, parentcustomerid), and account statecode 0 means active.
Output:
<fetch top="10">
<entity name="account">
<attribute name="accountid" />
<attribute name="name" />
<order attribute="accountid" />
<link-entity name="contact" from="parentcustomerid" to="accountid"
link-type="outer" alias="related_contact" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
<condition entityname="related_contact" attribute="contactid" operator="null" />
</filter>
</entity>
</fetch>
Each row is one active account with no matching contact visible to the executing caller through that relationship. This does not test account.primarycontactid. The null check applies after the outer join. This illustrative example has not itself established live validation in the user's environment.
Input: “Fetch approved project requests with their sponsor name.” No schema is supplied.
Output: Ask for the request table's logical name, approval column and approved value, and sponsor relationship metadata. Do not manufacture a publisher prefix or executable query from display labels.
Write a glossary, record ADRs, and clarify vague terms.
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
OBobra/superpowers331k5,030 new stars in the last 7 days