1
---
2
name: dataverse-schema-architect
3
description: Designs a production-ready Microsoft Dataverse data model from a business process described in plain language. Use when the user asks to design Dataverse tables, columns, choices, relationships, alternate keys, security roles or a solution structure, to model a process for Power Apps or Copilot Studio, or says "diseña el modelo de datos en Dataverse". Outputs a design doc, Mermaid ER diagram, column dictionary and security matrix.
4
---
5
6
# Dataverse Schema Architect
7
8
Turns a business process described in natural language into a complete, reviewable Microsoft Dataverse data model: tables, columns, choices, relationships with cascade behavior, alternate keys, security roles, column security, auditing and solution packaging — following Microsoft naming and ALM best practices.
9
10
The goal is a design a senior Power Platform architect would sign off on **before** anyone opens the maker portal, so the model does not have to be rebuilt after the first sprint.
11
12
---
13
14
## Before Starting
15
16
**Critical**: Always ask the user for the following information before proceeding. If the user doesn't provide all details upfront, ask for the missing ones before proceeding (in a single message, not one question at a time).
17
18
1. **Process description** — what happens, who does it, in what order, and which documents/records are produced (a paragraph, a transcript, a BPMN export or a list of current Excel/SharePoint lists is fine)
19
2. **Publisher prefix** — 2–8 lowercase alphanumeric characters starting with a letter (e.g. `cnt`). Defaults to `new` only as a placeholder, and you must warn that `new` must not be used in production
20
3. **Personas and access** — roles that create, approve, read or administer the data, and whether data is segregated by business unit, region, client or team
21
4. **Volume and integration** — approximate records per year for the main tables, and external systems that will sync data (ERP, SharePoint, Azure, APIs). Defaults to "low volume, no integration" if not specified
22
5. **Consumers** — model-driven app, canvas app, Power Pages, Copilot Studio agent, Power BI / Fabric (Synapse Link). Defaults to model-driven app + Power BI
23
6. **Language** — language for display names and the design document. Defaults to the language the user writes in; schema names are always English-style without spaces or accents
24
25
If a detail is still missing after asking once, proceed and list the assumption explicitly in the **Assumptions** section.
26
27
---
28
29
## Output Structure
30
31
Produce a single Markdown design document with these sections, in this order:
32
33
1. **Summary** — 3–5 lines: the process, number of tables, key design decisions
34
2. **Assumptions & Open Questions** — numbered; each assumption tagged `[ASSUMED]`, each open question tagged `[DECIDE]`
35
3. **Entity-Relationship Diagram** — a Mermaid `erDiagram` block with every custom table, the main standard tables used (`account`, `contact`, `systemuser`, `team`, `businessunit`) and all relationships with cardinality
36
4. **Table Catalog** — one table per row:
37
38
| Display name | Schema name | Type | Ownership | Primary name column | Purpose | Est. volume | Audit |
39
|---|---|---|---|---|---|---|---|
40
41
5. **Column Dictionary** — one sub-section per table:
42
43
| Display name | Schema name | Data type / format | Required | Default | Searchable | Notes (choice values, formula, behavior) |
44
|---|---|---|---|---|---|---|
45
46
6. **Choices** — global choices with label → value (value prefix from the publisher, e.g. `100000000`), and which columns use them
47
7. **Relationships** — schema name, type (1:N / N:1 / N:N), parent → child, relationship behavior (Parental / Referential / Referential, Restrict Delete / Custom) and cascade settings when Custom
48
8. **Alternate Keys** — for every table that is integrated or imported
49
9. **Security Model** — security roles × tables matrix with privilege depth (`None`, `User`, `BU`, `Parent:Child BU`, `Org`) for Create, Read, Write, Delete, Append, Append To, Assign, Share; plus column security profiles and team/business unit strategy
50
10. **Solution & ALM** — solution name, publisher, components list in build order, environment variables, connection references, managed vs unmanaged guidance
51
11. **Build Checklist** — ordered checklist the maker follows to create the model in the maker portal or with `pac` CLI
52
12. **Risks & Anti-patterns Avoided** — what the design deliberately does not do and why
53
54
---
55
56
## Step 1: Decompose the Process
57
58
- Identify **nouns that have a lifecycle** (they are created, change status, are approved, closed) → candidate tables
59
- Identify **nouns that are only descriptors** (type, category, priority) → choice columns, unless they need their own attributes, security or are maintained by business users → then a lookup/catalog table
60
- Identify **events and history** → status columns + audit, not separate "history" tables, unless the user needs to report on each transition with its own data
61
- Map every actor to `systemuser` / `team` / `contact` (external people) / `account` (external organizations) **before** creating custom tables for people or companies
62
- Reuse standard tables whenever their semantics match (`account`, `contact`, `task`, `email`, `note/annotation`). Never create `cnt_customer` if `account` fits
63
64
## Step 2: Define Tables
65
66
For each table decide and justify:
67
68
- **Type**: Standard; Activity (only if it represents an interaction with a start/end that should appear in timelines); Elastic (only for very high-volume, append-mostly data); Virtual (only when data must stay in the external system)
69
- **Ownership**: User or team owned (default — required when access differs by owner/BU) or Organization owned (reference/catalog data). Warn that ownership **cannot be changed after creation**
70
- **Primary name column**: meaningful human-readable value. If no natural name exists, use an **Autonumber** pattern (e.g. `INS-{SEQNUM:6}`) and say so
71
- **Schema name**: `<prefix>_<PascalCaseSingularNoun>` (e.g. `cnt_Inspection`); logical name is the lowercase form (`cnt_inspection`). Singular, English, no accents, no spaces, no abbreviations that only one team understands
72
- **Display name**: singular and plural forms in the requested language
73
- **Auditing**: enable for tables with compliance, financial or approval data
74
- Enable **Notes/attachments** only if needed; prefer **File** or **Image** columns for typed documents
75
76
## Step 3: Define Columns
77
78
Choose the most specific data type. Apply these rules:
79
80
| Need | Use | Avoid |
81
|---|---|---|
82
| Fixed list maintained by IT | Choice (global if reused in 2+ tables) | Text column with "allowed values" |
83
| List maintained by business users or with extra attributes | Lookup to a catalog table (org-owned) | Choice that changes every month |
84
| Multiple selections for filtering only | Choices (multi-select) | Multi-select when you need reporting per value — use an N:N or child table instead |
85
| Money | Currency (note that it adds base-currency columns and requires `transactioncurrency`) | Decimal for money |
86
| Dates without time (birth date, due date) | Date only, behavior **Date Only** | Date and Time with User Local (causes off-by-one-day across time zones) |
87
| Timestamps of events | Date and Time, behavior **User Local** | Text |
88
| Derived values | **Formula** column (Power Fx). In `DateDiff`, never mix User Local with Time-Zone Independent / Date Only columns: pair User Local columns with `Now()`, TZI or Date Only columns with `UTCNow()` / `UTCToday()`. Formulas using `UTCNow()` can't feed rollups | Legacy Calculated columns for new designs |
89
| Aggregates from children | Rollup column (state refresh is asynchronous) or Power BI | Plugins only for counts |
90
| Sequential human IDs | Autonumber | Flows that compute "max + 1" |
91
| Documents | File column (set max size) | URLs to random SharePoint folders |
92
| Yes/No | Yes/No with explicit default | Choice with two values |
93
94
- Add **Status** (`statecode`) and **Status Reason** (`statuscode`) values that map to the process lifecycle — design them; do not leave the defaults Active/Inactive when the process has more states
95
- Mark columns **Business Required** only when the process truly cannot continue without them; use business rules/forms for conditional requirements
96
- Flag columns holding **personal or sensitive data** (ID numbers, health, salary, minors) with `🔒 PII` and route them to a column security profile in Step 6
97
- Keep text lengths realistic (e.g. 100 for names, 4000 only when needed)
98
99
## Step 4: Define Relationships
100
101
- Prefer **N:1 lookups** from child to parent. Name them `<prefix>_<Parent>_<Child>` or by the lookup column (`cnt_InspectionId`)
102
- **Parental** (cascade all) only when the child has no meaning without the parent (e.g. inspection → findings). Remember a table can only be the child in **one** parental relationship
103
- **Referential, Restrict Delete** for master data that must not be deleted while in use (e.g. site → inspections)
104
- **Referential** (remove link) for optional associations
105
- **Custom** only with explicit cascade rules for Assign, Share, Unshare, Reparent, Delete, Merge — document each
106
- **N:N**: use native N:N only for pure associations with no attributes; if the association needs data (date, role, quantity), create an explicit intersect table with two lookups
107
- Avoid polymorphic lookups and circular cascades unless strictly required; explain them if used
108
109
## Step 5: Define Alternate Keys and Integration
110
111
- Every table that is synced, imported or upserted from an external system gets an **alternate key** on the external ID (e.g. `cnt_ErpCode`). Creating the key starts a background index job; the key can't be used until its status is **Active** (Pending → In Progress → Active / Failed), so include that check in the Build Checklist
112
- Recommend **upsert** via Dataverse Web API / Power Automate with the alternate key instead of "list rows + condition + create/update"
113
- For Fabric / Power BI consumers, state whether **Azure Synapse Link / Link to Microsoft Fabric** is recommended and which tables to include
114
- Note any API throttling or volume concern from Step 0 (Before Starting) inputs
115
116
## Step 6: Design Security
117
118
- Start from **least privilege**. Build one role per persona, never "everyone gets System Customizer"
119
- Use the privilege depth that matches the segregation requirement: `User` (own records), `BU` (my unit), `Parent:Child BU` (my unit and below), `Org` (everyone)
120
- Remember **Append** (on the child) and **Append To** (on the parent) are both required to set a lookup
121
- Use **owner teams** or **Microsoft Entra ID group teams** to grant access to groups rather than assigning roles user by user
122
- Put PII / sensitive columns in a **column security profile** with explicit Read / Create / Update rights
123
- If external users (Power Pages) are in scope, state that access is governed by **table permissions and web roles**, not security roles
124
- Output the matrix from the Output Structure, using these markers: `—` None, `U` User, `B` BU, `P` Parent:Child BU, `O` Org
125
126
## Step 7: Package for ALM
127
128
- One **unmanaged solution** in development under the custom publisher; **managed** in test/production
129
- List components in dependency order: global choices → tables → columns → relationships → keys → views/forms → security roles → column security profiles → environment variables → connection references
130
- Recommend environment variables for any URL, email or ID that changes per environment
131
- Recommend source control via `pac solution export` / `pac solution unpack` (or Git integration in Power Platform) when the user mentions DevOps or GitHub
132
- Do **not** add the standard tables with all their components ("include all objects") — add only the required ones
133
134
## Step 8: Validate and Present
135
136
- Run the **Validation Checklist** below against your draft and fix any failure before presenting
137
- Present the full document. Then add a short "Next steps" paragraph offering to: generate forms/views, generate a Power Apps canvas YAML screen, generate Copilot Studio knowledge/actions for the tables, or produce `pac` CLI / Web API payloads
138
139
---
140
141
## Rules
142
143
- **NEVER invent business requirements** — every table and column must trace back to the process description or be listed as `[ASSUMED]`
144
- **NEVER use the `new_` or `cr123_` default prefixes** in a production design; flag them if the user provides them
145
- **NEVER create custom tables for users, teams, business units, accounts or contacts** when the standard table fits
146
- Schema names: English, singular, PascalCase after the prefix, no accents or spaces. Display names: in the user's language
147
- Always explain **why** for every non-obvious decision (ownership, relationship behavior, choice vs lookup)
148
- Prefer the simplest model that supports the process; if the user asks for something that adds complexity without value, say so and propose the alternative
149
- Do not claim the model has been created in any environment — this skill designs; it does not deploy
150
- Respond in the same language the user writes in
151
152
---
153
154
## Examples
155
156
### Example: Workplace safety (EHS/SST) inspections
157
158
**Input (user):**
159
> Our safety team inspects each plant monthly. An inspector fills a checklist, records findings with photos and a risk level (low, medium, high, critical). Each finding can have one or more corrective actions assigned to a person with a due date. Plant managers only see their plants; the safety director sees everything. We already have plants in our ERP with a code. Prefix: `cnt`.
160
161
**Output (excerpt):**
162
163
**Summary** — 4 custom tables (`cnt_Site`, `cnt_Inspection`, `cnt_Finding`, `cnt_CorrectiveAction`), 1 global choice (`cnt_risklevel`), segregation by business unit per plant, alternate key on the ERP plant code.
164
165
```mermaid
166
erDiagram
167
businessunit ||--o{ cnt_Site : "owns"
168
cnt_Site ||--o{ cnt_Inspection : "Restrict Delete"
169
systemuser ||--o{ cnt_Inspection : "inspector"
170
cnt_Inspection ||--o{ cnt_Finding : "Parental"
171
cnt_Finding ||--o{ cnt_CorrectiveAction : "Parental"
172
systemuser ||--o{ cnt_CorrectiveAction : "responsible"
173
```
174
175
**Table Catalog**
176
177
| Display name | Schema name | Type | Ownership | Primary name column | Purpose | Est. volume | Audit |
178
|---|---|---|---|---|---|---|---|
179
| Site | `cnt_Site` | Standard | User/Team (owned by plant BU team) | `cnt_Name` | Plant master data synced from ERP | < 100 | Yes |
180
| Inspection | `cnt_Inspection` | Standard | User/Team | `cnt_Code` Autonumber `INS-{SEQNUM:6}` | Monthly inspection header | ~1,200/yr | Yes |
181
| Finding | `cnt_Finding` | Standard | User/Team | `cnt_Title` | Each non-conformity found | ~6,000/yr | Yes |
182
| Corrective Action | `cnt_CorrectiveAction` | Standard | User/Team | `cnt_Title` | Action to close a finding | ~8,000/yr | Yes |
183
184
**Column Dictionary — Finding (excerpt)**
185
186
| Display name | Schema name | Data type / format | Required | Default | Searchable | Notes |
187
|---|---|---|---|---|---|---|
188
| Inspection | `cnt_InspectionId` | Lookup → `cnt_Inspection` | Yes | — | Yes | Parental |
189
| Risk level | `cnt_RiskLevel` | Choice (global `cnt_risklevel`) | Yes | — | Yes | Low 100000000, Medium 100000001, High 100000002, Critical 100000003 |
190
| Evidence photo | `cnt_EvidencePhoto` | Image | No | — | No | Full-size image enabled |
191
| Days open | `cnt_DaysOpen` | Formula (Whole number) | — | — | No | `DateDiff(createdon, If(IsBlank('Closed on'), Now(), 'Closed on'), TimeUnit.Days)` — `createdon` and `cnt_ClosedOn` are User Local, so it uses `Now()` (User Local), not `UTCNow()` (Time-Zone Independent) |
192
193
**Security Model (excerpt)**
194
195
| Role \ Table | Site | Inspection | Finding | Corrective Action |
196
|---|---|---|---|---|
197
| Safety Inspector | R:`B` | C:`U` R:`B` W:`U` A:`B` AT:`B` | C:`U` R:`B` W:`U` A:`B` AT:`B` | C:`U` R:`B` W:`U` A:`B` |
198
| Plant Manager | R:`B` | R:`B` | R:`B` | C:`B` R:`B` W:`B` Assign:`B` |
199
| Safety Director | R:`O` W:`O` | R:`O` | R:`O` | R:`O` W:`O` Assign:`O` |
200
201
**Alternate Keys** — `cnt_Site.cnt_ErpCode` (upsert from ERP nightly).
202
203
**Risks & Anti-patterns Avoided** — risk level is a global choice, not free text; no custom "Users" table; findings are not a multi-line text field inside the inspection (would make reporting impossible); Days open is a Formula column instead of a nightly flow.
204
205
---
206
207
## Validation Checklist
208
209
Before presenting the design, verify:
210
211
- [ ] Every table and column traces to the process or is tagged `[ASSUMED]`
212
- [ ] All schema names use the agreed prefix, are singular, English, PascalCase, without accents
213
- [ ] Standard tables are reused where they fit (no duplicate user/account/contact tables)
214
- [ ] Every table has an explicit ownership decision and a meaningful primary name column
215
- [ ] Every Date column has an explicit behavior (User Local / Date Only / Time-Zone Independent)
216
- [ ] Choice vs lookup decision is justified for every list
217
- [ ] Every relationship has a behavior; no table is the child in more than one Parental relationship
218
- [ ] Integrated tables have alternate keys, and the Build Checklist waits for each key's index status to be **Active** before the first upsert
219
- [ ] Every Formula column with dates pairs behaviors correctly (User Local with `Now()`; Time-Zone Independent / Date Only with `UTCNow()`)
220
- [ ] Every persona has a security role; Append/Append To are consistent with the lookups
221
- [ ] PII columns are in a column security profile
222
- [ ] The Mermaid diagram renders (valid `erDiagram` syntax) and matches the Relationships section
223
- [ ] The Build Checklist is ordered by dependency
224
225
---
226
227
## References
228
229
- [Create and edit tables in Dataverse](https://learn.microsoft.com/power-apps/maker/data-platform/create-edit-entities-portal)
230
- [Types of columns](https://learn.microsoft.com/power-apps/maker/data-platform/types-of-fields)
231
- [Formula columns](https://learn.microsoft.com/power-apps/maker/data-platform/formula-columns)
232
- [Table relationships and behavior](https://learn.microsoft.com/power-apps/maker/data-platform/create-edit-1n-relationships-portal)
233
- [Define alternate keys](https://learn.microsoft.com/power-apps/maker/data-platform/define-alternate-keys-portal)
234
- [Security concepts in Dataverse](https://learn.microsoft.com/power-platform/admin/wp-security-cds)
235
- [Column-level security](https://learn.microsoft.com/power-platform/admin/field-level-security)
236
- [Solution publishers](https://learn.microsoft.com/power-apps/maker/data-platform/create-solution#solution-publisher)
237
- [Date and time column behavior](https://learn.microsoft.com/power-apps/maker/data-platform/behavior-format-date-time-field)
238