Skip to main content
skill CX Codex

add-sample-data · microsoft, mobile-apps — Claude Code skill: seed Dataverse tables

add-sample-data is a Claude Code skill that populates Dataverse tables with realistic, schema-matched records in dependency order, so a newly created app has complete data on first load.

MIT ★ 1,167 updated 2026-10-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add microsoft/power-platform-skills
/plugin install mobile-app@power-platform-skills
Open on GitHub

What add-sample-data does

After creating tables with /add-dataverse, you need sample data so the app feels real. add-sample-data reads each table's schema and generates contextually appropriate values: a sitename column gets "Westside Construction Site", not "Sample Name 1". Rows insert in the correct order—parent tables first, then children—so foreign keys resolve.

The skill works only with an approved table list (the --tables flag), not the entire manifest. If a previous run stopped partway, the next run checks memory-bank.md and skips records already inserted. Insert failures are logged and the skill continues without rollback.

You can reuse seed data from a prototype: when converting a mock app to real Dataverse, the --from-seed flag pulls existing .seed.json files, translates them to Dataverse format, and generates new rows for the rest.

What it helps with

  • populate Dataverse with realistic samples on first app run
  • link parent and child tables through foreign keys in dependency order
  • migrate test data from a prototype to live Dataverse
  • re-run generation without duplicating already inserted records

Example prompts for the agent

  • Seed Dataverse tables contacts, accounts, and inspections with contextually appropriate sample records
  • Generate data for contacts and orders, excluding the retiring table, starting with 5 rows each
  • Resume data insertion from the prototype seed files and fill remaining tables

How to install add-sample-data

1Plugin marketplace

/plugin marketplace add microsoft/power-platform-skills
/plugin install mobile-app@power-platform-skills

This installs the whole mobile-app plugin with all its skills

2Skills CLI (Vercel)

npx skills add microsoft/power-platform-skills --skill add-sample-data -a claude-code

3Manually: put the files in place

~/.claude/skills/add-sample-data/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/add-sample-data/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about add-sample-data

How do I install add-sample-data in Claude Code?

Run /plugin marketplace add microsoft/power-platform-skills, then /plugin install mobile-app@power-platform-skills. To access directly, use npx skills add microsoft/power-platform-skills --skill add-sample-data -a claude-code.

What does add-sample-data do?

Generates and inserts realistic sample records into Dataverse tables based on their schema. Values are chosen to match column names and types; rows insert in dependency order so foreign keys work.

Can I reuse data from a prototype?

Yes. Use the --from-seed flag to find .seed.json files in your prototype, translate them to Dataverse format, and insert them. Remaining tables are filled with newly generated data.

Source text

SKILL.md · MIT
---
name: add-sample-data
description: Use when the user wants to seed Dataverse tables with realistic sample records so a freshly-scaffolded code app shows real-looking data on first launch. Generates contextually appropriate rows from each table's schema and inserts them in dependency order. Mirrors microsoft/power-platform-skills/power-pages/add-sample-data, adapted for mobile apps.
user-invocable: true
allowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion
model: sonnet
---

> **Plugin check**: Run `node "${PLUGIN_ROOT}/scripts/check-version.js"` - if it outputs a message, show it to the user before proceeding.

**📋 Shared instructions: [shared-instructions.md](${PLUGIN_ROOT}/shared/shared-instructions.md)** — read first.

# Add Sample Data

**App root:** before any project read or command, execute
[app-working-directory.md](${PLUGIN_ROOT}/shared/references/app-working-directory.md).
Use its resolved absolute `working_dir` for every shell call and file tool,
including media paths and retries; never inherit a prior `cd`.

Populate Dataverse tables with realistic sample records so a freshly-scaffolded code app shows real-looking data on first launch. Generates rows from each table's schema and inserts them in dependency order. Use after `/add-dataverse` (or `/setup-datamodel`) has created the tables.

## Core principles

- **Coverage within approved scope, not the entire manifest.** Cover each eligible
  approved table with a small useful dataset. The manifest is verified app
  inventory and can include retiring or unrelated tables; its presence is not
  permission to seed them. Scope and retirement exclusions override every
  coverage, fanout, prototype-reuse, media, and retry rule below.
- **Insertion order matters.** Parent / referenced tables must be inserted before child / referencing tables so lookup IDs are available.
- **Contextual data, not Lorem Ipsum.** Generate values that match column names + types. A `cr3e9_sitename` column in an inspection app gets "Westside Construction Site", not "Sample Name 1".
- **Scenario-aware rows.** Read `native-app-plan.md` when present, especially `### Shared Conventions` and per-screen `Operational pattern` values defined in [screen-templates.md](${PLUGIN_ROOT}/shared/references/screen-templates.md); otherwise use the current data request and verified schema. Seed rows should exercise the app's actual workflow: statuses, dates, relationships, priority/severity, media metadata, and edge cases that make the planned first viewport light up.
- **Fail gracefully.** On insertion failure, log the error and continue with remaining records — never auto-rollback. The user can re-run after fixing the issue.
- **Idempotent re-runs.** If a previous run partially completed, the second run reads `memory-bank.md`'s seeded-data table and skips records already inserted.
- **Solution-scoped inserts.** Always pass `--solution <uniqueName>` so records land in our solution, not the default.

## Workflow

0. Resolve approved seed scope → 1. Verify project + auth → 2. Discover scoped tables → 3. Select tables + count → 4. Generate + preview → 5. Insert → 6. Summary

### Step 0 — Resolve approved seed scope

Inputs are skill arguments, not flags for `dataverse-request.js`:

- `--working-dir <absolute-root>`: inherit the caller's root; reject conflicting
  explicit/inherited roots. Never default to shell cwd in a nested invocation.
- `--tables <comma-separated-logical-names>`: the exact approved seed-table
  allowlist. Required for every orchestrated call, including fresh creation.
- `--exclude-tables <comma-separated-logical-names>`: retiring table names from
  the approved edit; omit or pass an explicit empty string only when none retire.

For an orchestrated call, require the scoped handoff and matching `--tables`
before auth, record-count queries, or generation. A missing or malformed
allowlist returns `NEEDS_CONTEXT`; never fall back to all manifest tables.
An explicitly empty allowlist is a no-op: report no approved seed tables and
return without cloud calls or writes.

Validate logical names against the manifest and the approved plan/caller scope.
Build `retiringTables` from the caller's retirement set plus any pending removals
recorded in the current plan/history; include these in `--exclude-tables`.
If an allowlisted name is absent/unverified or overlaps `retiringTables`, stop
before insertion and return the scope mismatch. Do not silently drop unknown
names or infer permission from a transitional manifest entry.

For a standalone request, honor explicit `--tables` and exclusions. If no table
list was supplied, discover candidates in Step 2 and ask the user to approve the
specific table set/counts before Step 5, then freeze that selection as `seedTables`.
For this standalone discovery path, validate against verified metadata when the
local manifest is absent; never treat the discovery result itself as approval.
Pending retirement always excludes a
candidate; if that state is unclear, ask rather than treating the manifest as
approval. Read-only fallback discovery is not permission to seed the environment.

Keep a fixed `seedTables` allowlist throughout the invocation. All later
selection, batches, media jobs, and resume operations must remain within it.
Do not edit `.datamodel-manifest.json` or the app plan to make an excluded table
eligible. Expanding scope requires returning to the owning approval gate.

For `--plan-only` or a planning-phase handoff, use the supplied proposed table
scope for read-only checks and return the proposed counts, dependency needs, and
media policy before Step 5. Planning approval is not insertion approval.
Do not generate media files, insert/update/upload records, or change the app
plan, manifest, or seeded-data history on this path.

## Prototype Seed Reuse

`--from-seed` is used by `/prototype-to-real-app` after a mock prototype is converted to Dataverse. In this mode, prefer existing prototype seed files before generating new rows:

```text
src/generated/services/*/*.seed.json
src/generated/services/*.seed.json
```

Map only `seedTables` objects to Dataverse payloads using `.datamodel-manifest.json`;
prototype seed files cannot widen the approved set:

- Keep values only for real manifest columns.
- Translate lookup references into exact `<schemaName>@odata.bind` keys from the manifest.
- Keep picklist integers from the manifest; do not invent values from labels.
- Skip local-only prototype fields that have no Dataverse column.
- Preserve dependency-tier insertion order.

If a seed file cannot be mapped safely, fall back to generated contextual sample rows for that table and record `DONE_WITH_CONCERNS` in the summary. `--from-seed` is a preference, not permission to insert malformed data.

---

### Step 1 — Verify project & auth

Run app-local commands from the resolved `working_dir` in each shell call.

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
if [ ! -f power.config.json ] || [ ! -f app.config.js ]; then
  echo "BLOCKED: working_dir is not an initialized app" >&2
  exit 1
fi
environment_id="$(node -p "require('./power.config.json').environmentId || ''")" || exit 1
if [ -z "$environment_id" ]; then
  printf '%s\n' 'ERROR: selected app has no environmentId' >&2
  exit 1
fi
node "${PLUGIN_ROOT}/scripts/resolve-environment.js" "$environment_id" --no-cache --require-tenant
```

Capture the **environment URL**, **environment ID**, and **tenant ID** for
subsequent script calls; require a match with the selected app and any supplied
owner context. Incomplete or conflicting identity returns `NEEDS_CONTEXT` after
bounded read-only recovery. Do not remove the safety flags, select another
environment, or persist resolver output to recover.

Bind every subsequent Dataverse read, batch, PATCH, media upload, token refresh,
and retry to that exact environment URL and tenant ID. For each
`dataverse-request.js` invocation, pass
`--tenant-id '<tenantId-from-resolve-environment>'` explicitly; substitute the
validated Step 1 value again in every fresh shell call. Do not depend on a
previous shell export, challenge discovery, or the active Azure CLI tenant.
Missing or conflicting tenant context returns `NEEDS_CONTEXT` before the call.

Verify Azure CLI auth (the script needs an Azure CLI token):

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
az account show --query "user.name" -o tsv
```

If empty, instruct `az login` and stop.

### Step 2 — Discover tables

**Telemetry checkpoint: `discover_dataverse_tables`**

#### Step 2a — Path A: read `.datamodel-manifest.json` (preferred)

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
test -f .datamodel-manifest.json
```

If present, parse the JSON. It contains `logicalName`, `displayName`, `status`
(`new` / `extended` / `reused`), and `columns` for the verified app inventory.
**This is the preferred path** -- fast, no API calls. For scoped calls, take only
the validated `seedTables` entries before any per-table metadata/count query.
For standalone discovery, exclude retiring tables from the candidate list.

Keep unrelated manifest entries as inventory only; do not pass them to the
record-count, generation, or insertion loops.

Skip Step 2b.

#### Step 2b — Path B: query OData (fallback)

If `.datamodel-manifest.json` is missing in an orchestrated call, return `BLOCKED`
to the owner for verified inventory recovery; do not broaden discovery or invent
schema facts. For a standalone request with an explicit allowlist, fetch metadata
only for those logical names. The following broad discovery is for a standalone
request without a table list, to propose candidates for approval:

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
node "${PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> GET \
  "EntityDefinitions?\$select=LogicalName,DisplayName,EntitySetName&\$filter=IsCustomEntity eq true" \
  --tenant-id '<tenantId-from-resolve-environment>'
```

For each candidate that the project uses (or each explicitly scoped table),
fetch its custom columns:

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
node "${PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> GET \
  "EntityDefinitions(LogicalName='<table>')/Attributes?\$select=LogicalName,DisplayName,AttributeType,RequiredLevel&\$filter=IsCustomAttribute eq true" \
  --tenant-id '<tenantId-from-resolve-environment>'
```

Build the same `{ logicalName, displayName, columns: [...] }` shape the manifest provides.

### Step 3 — Select tables + count

Evaluate only the validated seed allowlist, including reused tables only when
they are explicitly in that set. For standalone discovery, use only the proposed
non-retiring candidates and obtain the selection approval before insertion.
Never seed standard system tables (e.g. `contact`, `account`, `systemuser`)
without the additional explicit shared-environment confirmation below.

**Pre-seeding row-count check (HARD — runs for every table before generating any rows):**

For each scoped table, query its current record count using the verified entity
set name from the manifest, or fetch that name from metadata as in Step 5a.
Never derive it by appending `s` to a logical name.

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
node "${PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> GET \
  "<entitySetName>?\$top=5&\$select=<primaryKeyColumn>" \
  --tenant-id '<tenantId-from-resolve-environment>'
```

Count the rows returned in the `value` array.

| Existing record count | Action |
|---|---|
| **≥5** | **Skip this table entirely.** Log: `↷ <table> (≥5 records exist, skipping)`. Do not generate or insert any rows. |
| **<5** | Seed enough new rows to reach the per-class target count. If some records already exist (e.g. 2), generate only the gap (e.g. 3 more to reach 5). |

If all eligible selected tables already have ≥5 records, report that nothing in
the approved seed scope needs seeding and stop.

**Per-table count by class** (classify each table from manifest signals before generating; this beats a uniform `5` because reference tables don't need volume and transactional tables need state spread):

  | Class | Heuristic | Default count | Rationale |
  |---|---|---|---|
  | **Reference** | No `status` / `state` column; columns are descriptive (name, address, phone). Often Tier 0. | **3** | Stores, customers, sites, products. Small stable set. |
  | **Junction** | Two-or-more lookups, no other meaningful columns. Often Tier 1. | **3 × parent count, capped at 9** | Store-Assignment, Project-User. Needs to span the join. |
  | **Transactional** | Has a `status` / `state` / `phase` choice column AND a date column (`createdon`, `submittedat`, `completedat`). | **5** | Audits, inspections, orders, tickets. Need state mix to make tiles light up. |
  | **Detail / line-item** | Lookup back to a transactional parent, no own state column. | **2-3 per parent** | Audit zones, order line items, inspection findings. |
  | **Issue / finding** | Lookup back to a transactional parent + has `status` (Open / Resolved) AND severity (Critical / Moderate / Minor). | **3-4 per transactional parent** | Issues, defects, observations. Mix severities + statuses (see Step 4a). |
  | **Evidence / attachment** | Has a File / Image column + lookup to issue/inspection. | **1 per ~30% of parents** | Photo evidence, document uploads. Seed metadata rows by default; seed file/image bytes only when `brand/media-policy.md` or the user's request says sample media is needed. |
  | **Log / event / audit-trail** | Append-only with `eventtype` enum + timestamp + actor lookup. | **2 per transactional parent** | Audit log events, activity stream. Mix at least 2 event types per parent. |
  | **Override / approval** | Lookup to transactional parent + status (Pending / Approved / Rejected). | **1 per ~20% of parents** | Override requests, approval queue. At least 1 row in `Pending` so queue tab shows content. |

  Counts are intentionally minimal. Goal: every screen has SOMETHING to render, not a demo dataset.

Print a one-line summary and continue:

> `→ Seeding <total> records into <N> tables (coverage-first; counts auto-tuned per class).`

#### Step 3b — Determine insertion order

For the selected tables, build a dependency graph from lookup columns:

1. Tables with no lookups out → Tier 0 (insert first)
2. Tables with lookups only to Tier 0 → Tier 1
3. Continue until all selected tables are tiered

If a selected table references an UNSELECTED parent, reuse a verified existing
parent record through a bounded read when that lookup is within the approved
feature. Reading a lookup parent is not permission to insert/update it. If no
suitable record exists, return `NEEDS_CONTEXT` to the owner (or ask standalone)
to extend the seed scope or explicitly omit an optional lookup. Never auto-add
a parent to `seedTables`, create a retiring parent, or omit a required lookup.
Retiring lookup targets block that dependent seed until the plan is reconciled.

### Step 4 — Generate sample data + preview

**Telemetry checkpoint: `generate_and_review_sample_records`**

#### Step 4a — Generate contextual rows

For each selected table, generate N rows. Match values to column names + types:

| Column type | Generation approach |
|---|---|
| **String** | Match the column name's semantic. `*name`, `*title` → realistic names from the requirements brief context. `*email` → `[email protected]`. `*phone` → `(555) 123-NNNN`. `*address` → realistic street + city. Otherwise: short context-appropriate text. |
| **Memo (multi-line text)** | 1-3 sentences relevant to the column name (e.g. `*notes`, `*description`). |
| **Integer / Decimal / Currency** | Reasonable range based on column name. `*amount`, `*price` → realistic dollars. `*count`, `*quantity` → small integers (1-100). |
| **DateTime / DateOnly** | Recent ISO dates spanning past 30 days to next 14 days. Vary across rows. |
| **Boolean** | Mix true/false (~70/30 favoring true for `is_active` style names). |
| **Choice (Picklist)** | **Query options first** (Step 4b), then pick from valid integer values. |
| **MultiSelect Choice** | Pick 1-3 valid values per row from the option set. |
| **Lookup** | Reference a verified existing parent or one inserted within the approved seed scope. Track live parent GUIDs; never seed an unapproved parent just to satisfy a child. |
| **Image / File** | Default: skip — leave null. If media seeding is enabled and the column is business data (product image, inspection evidence, NC proof), use generated/synthetic local files from `assets/sample-*` and record provenance. Never upload decorative UI hero assets to Dataverse. |

**Media seeding policy (business data only, only if needed):**

- Default: do not seed binary media. Seed metadata rows and leave Image/File columns null unless the screen plan or user request requires visible sample media.
- Seed Dataverse images/files only when the image belongs to a record users inspect in list/detail screens: product photos, evidence, attachments, signatures, issue proof. Do NOT seed Home hero, splash, app icon, empty-state art, or decorative detail backgrounds.
- Prefer generated/synthetic assets with no logos, no real product labels, no faces, no watermarks, and no competitor branding. If the user supplies approved assets, use those and record their source.
- CDN URLs are valid only for explicit URL/Text columns (e.g. `imageurl`, `photourl`). Do not put CDN URLs into File/Image columns.
- Dataverse Image columns receive base64 in the row payload or generated service shape. Dataverse File columns require a second upload step after the metadata row exists.
- For product/channel apps, product images are core sample data when product list/detail screens are visual, but they are capped. Generate and upload only a representative subset; use local placeholders or null image fields for the rest.
- Maintain `assets/images/asset-manifest.json` or `assets/sample-media/asset-manifest.json` with file, purpose, source/license, and safety notes.

**Media volume limits (HARD):**

- Product/catalog tables: upload images for at most **min(6, record count)** records by default. If records are category-based, choose 1-2 per category until the cap is reached. All remaining records rely on local placeholder thumbnails or empty-state fallback.
- Evidence/attachment tables: upload sample files for at most **30% of parent records**, capped at **5 files total per table**. Metadata rows can still exist without file bytes.
- User/avatar/equipment/site images: upload at most **3 per table** unless the user explicitly asks for a larger visual demo.
- Never create more than **10 generated media files total** in one `/add-sample-data` run without explicit user approval.
- If the calculated sample row count exceeds the media cap, prefer diverse coverage over volume: one hero product, one secondary product, one edge/status example, then placeholders.

**How sample images are inserted:**

1. Generate the normal record body first (name, lookup fields, status, etc.).
2. For **Image columns**, attach a compact base64 payload in the create/PATCH body only if the generated model/service expects base64 for that column. Keep the image small enough for mobile thumbnails.
3. For **File columns**, do NOT put bytes/base64/URLs in the create body. Insert the metadata row first, capture the GUID from Step 5's `BATCH-RECORDS` result, then upload the generated file to `(recordId, columnName)` in Step 5d.
4. Stop once the media cap is reached. Remaining records keep null Image/File columns and use local placeholders in the app UI.
5. If no upload helper exists for File columns, leave the column null and report `sample media skipped — upload helper missing`. Never fake File/Image data with a URL string.

**Pull context from the requirements brief.** The user described what the app does (e.g. "HVAC inspection app for field technicians"); use that to flavor the data — sites named after streets typical for the user's industry, statuses in the right vocabulary. Generic Lorem Ipsum is the failure mode.

**Per-parent fanout floor (HARD).** For every child table in Tier K+, generate AT LEAST 1 row per parent row from Tier K-1 unless the relationship is explicitly optional (`RequiredLevel: None` in the manifest AND the column name doesn't imply 1-to-many like `*audit*`, `*inspection*`, `*order*`). Without this floor, random lookup distribution leaves some parents with zero children and the parent's detail screen renders empty. Concrete rule: if generating `audit_zones` and there are 5 audits, generate AT LEAST 5 zones (one per audit), then add 0-2 more per audit until you hit the per-class count target. Never the reverse — never generate `N` total and let chance decide which parent each row picks.

**State / status distribution (HARD for transactional, issue, override classes).** If a table has a `status` / `state` / `phase` / `severity` / `priority` choice column, **distribute rows across at least 2 distinct values** — never all-`Open`, never all-`InProgress`. Concrete rules:

- **Transactional** (`audit`, `inspection`, `order`): mix at least 3 lifecycle states from the option set if available — typically 1 row in an early state (`Draft` / `InProgress`), 1 in a mid state (`Submitted` / `PendingReview`), and the rest in a terminal state (`Signed` / `Completed` / `Closed`). If only 2 states exist, split ~60/40.
- **Issue / finding**: mix severity AND status independently. If 5 issues across 3 severities × 2 statuses, aim for ≥1 of each severity AND ≥1 `Open` AND ≥1 `Resolved`.
- **Override / approval**: at least 1 row in the queue-driving state (`Pending`) so the queue/inbox tab shows content; remainder distributed across `Approved` / `Rejected`.
- **Log / event**: at least 2 distinct `eventtype` values per parent (e.g. `Created` + `StatusChanged`).

**Date distribution (transactional / log only).** If the table has a `createdon` / `submittedat` / `completedat` / `eventtimestamp` column, spread rows across **today + last 14 days** (not all today, not all 30 days ago). Distribution: ~30% today/yesterday (drives "Recent activity" tiles), ~50% last 7 days, ~20% 8-14 days. Reference and detail tables can use any reasonable date — only transactional/log need temporal spread.

**Scenario archetype edge coverage (HARD when detectable).** Use the selected Power Apps scenario archetype to ensure at least one row exercises each critical state the app UI promises:

- Field inspection / audit: one blocked or evidence-missing audit, one in-progress audit, one completed/signed audit.
- Asset maintenance: one overdue/high-priority work order, one awaiting-parts order, one completed order.
- Inventory scan-first: one variance, one zero/low-stock item, one resolved count/transfer.
- Approvals: one pending item in the approval inbox, one approved, one rejected/changes-requested.
- CRM: one at-risk relationship, one upcoming follow-up, one healthy/won relationship.
- Retail catalog/order: one visual product, one low-stock/backordered example, one order with multiple lines.
- Case management: one escalated/SLA-risk case, one waiting-on-customer case, one resolved case.
- Onboarding/training: one overdue required module, one in-progress module, one completed/certified module.
- Expense/request intake: one missing-receipt draft, one pending approval, one approved/paid request.
- Health/wellness/care: one due-today care task, one missed/follow-up task, one completed/on-track goal.

#### Step 4b — Discover Choice options

For every choice column in the selected tables, query its option set before generating rows:

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
node "${PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> GET \
  "EntityDefinitions(LogicalName='<table>')/Attributes(LogicalName='<column>')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?\$expand=OptionSet" \
  --tenant-id '<tenantId-from-resolve-environment>'
```

Use the actual `Value` integers from the response. Don't hardcode `100000000`-style values — they vary per environment.

#### Step 4c — Preview to user

For each table, show a markdown table previewing the rows directly in the conversation:

```markdown
### Job Site (cr3e9_jobsite) — 5 records

| Site Name | Address | Square Feet | Active |
|---|---|---|---|
| Westside Construction Site | 4521 Industrial Pkwy | 12500 | true |
| Downtown Office Building   | 188 Main St           |  3200 | true |
| Eastgate Warehouse         | 9047 Logistics Way    | 28000 | false |
| Riverside Retail Plaza     | 320 River Rd          |  6800 | true |
| North Hills Distribution   | 1612 Highland Ave     | 18900 | true |
```

For tables with lookups, also show which parent record each child references:

> `cr3e9_inspection rows reference cr3e9_jobsite records by SiteName above.`

#### Step 4d — Proceed to insert

For `--plan-only` or a planning-phase handoff, return the preview and STOP here;
neither an earlier approval nor a populated manifest overrides that boundary.

Proceed without another prompt only when the exact seed tables/count policy and
any media writes are already approved in the current scoped handoff or explicit
standalone request. Otherwise obtain explicit approval of the preview first.
Row counts prevent duplicate volume; they are not consent. Cancellation stops.
If dependencies or rows require a wider scope, return to the owner rather than
approving the expansion inside an orchestrated leaf.

### Step 5 — Insert sample data

**Telemetry checkpoint: `insert_sample_records`**

**Print before starting:**
> "→ Inserting <total> records across <N> tables in dependency-tier order (parallel within each tier, cap 5 concurrent)…"

Insert in the tier order from Step 3c. **Within a tier, parallelize across both tables and rows** via the script's `BATCH-RECORDS` mode — single Node process, `Promise.all` with concurrency cap of 5. Across tiers stays sequential (children need parent GUIDs from prior tier's responses).

> **⚠️ Parallelism applies ONLY to record inserts.** Schema operations (table / column / relationship creation) MUST stay sequential — see [`/add-dataverse` Step 5 concurrency rule](../add-dataverse/SKILL.md#step-5--create--extend-tables). Records have no metadata lock; metadata writes do. Mixing them up returns 429 / `MetadataLockHeldException`.

#### Step 5a — Get entity set names

For each table, get its `EntitySetName` (the URL-path name, usually plural — e.g. `cr3e9_jobsites`). Read from `.datamodel-manifest.json` if it carries this; otherwise:

```bash
cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
node "${PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> GET \
  "EntityDefinitions(LogicalName='<table>')?\$select=EntitySetName" \
  --tenant-id '<tenantId-from-resolve-environment>'
```

Cache the result.

> **⚠️ Resolve EntitySetName for BOTH sides of every lookup.** You need the entity set name not only for the table you're inserting into (the `entitySet` field in BATCH-RECORDS), but also for every **lookup target** referenced in `@odata.bind` values (Step 5c). Entity set names are independent of logical names — Dataverse pluralises irregularly and version suffixes pass through verbatim. Examples that bite: `cr3e9_inspectionv3` → `cr3e9_inspectionv3s` (NOT `cr3e9_inspections`); `cr3e9_inquiry` → `cr3e9_inquiries`; `cr3e9_status` → `cr3e9_statuses`. **Never construct the path as `<logicalName>s` — always read it from EntityDefinitions.**

#### Step 5b — Insert one tier at a time, parallel within the tier

For each tier from 0 → N:

Before constructing or submitting a batch, re-check every target logical name
against `seedTables` and `retiringTables`. Resolve its exact entity set, and
reject the entire proposed batch if any insert/update targets an unapproved or
retiring table. Apply the same guard before media PATCH/upload and every retry;
an out-of-scope operation is a scope error, not a record failure to continue past.

1. **Build the operations array.** Collect every (entitySet, body) pair across all tables in this tier. Tag each with a unique `index` you'll use to map results back to your row identity.

   ```jsonc
   [
     { "index": 0, "entitySet": "cr3e9_jobsites", "body": { "cr3e9_sitename": "Westside Construction Site", "cr3e9_address": "4521 Industrial Pkwy", "cr3e9_squarefeet": 12500, "cr3e9_active": true } },
     { "index": 1, "entitySet": "cr3e9_jobsites", "body": { "cr3e9_sitename": "Downtown Office Building", "cr3e9_address": "188 Main St",          "cr3e9_squarefeet":  3200, "cr3e9_active": true } },
     { "index": 2, "entitySet": "cr3e9_inspectors", "body": { "cr3e9_fullname": "Jane Smith", "cr3e9_email": "[email protected]" } }
     // ... all rows for tables in this tier
   ]
   ```

   Maintain a side-map `{ index → { table, rowSemantic } }` so you can correlate results back to your tracking.

2. **Fire BATCH-RECORDS once per tier.** The script handles concurrency, retry, GUID extraction, and adaptive throttling internally:

   ```bash
   cd -- '<working_dir>' || { echo "BLOCKED: cannot enter working_dir" >&2; exit 1; }
   node "${PLUGIN_ROOT}/scripts/dataverse-request.js" <envUrl> BATCH-RECORDS \
     "Tier <N>" \
     --operations '<json-from-step-1>' \
     --concurrency 5 \
     --solution '<solution-uniquename-from-memory-bank>' \
     --tenant-id '<tenantId-from-resolve-environment>'
   ```

   Output is `{ "status": 200, "data": [{ "index": 0, "status": 204, "recordId": "<guid>" }, ...] }`. Results are ordered by input index (stable across parallel execution).

3. **Capture parent GUIDs.** For every successful row in the response, store `recordId` indexed by y...

© Microsoft · MIT · microsoft/power-platform-skills

Similar skills

All skills for Cloud: AWS, Azure, GCP →

add-sample-data by other authors comes first.

add-sample-data Microsoft add-sample-data — a Claude Code skill that seeds Dataverse tables with sample records so you can quickly set up test data for Power Pages demos. CX Codex +1 ★ 1,167repo stars security-generate-security-sample-data elastic security-generate-security-sample-data generates synthetic security events, attack scenarios and alerts for Elastic Security. Useful for demos, detection rule testing and POCs. CX Codex +1 4,200installs dataverse-python-sdk official github dataverse-python-sdk is a GitHub Copilot rule that adds official Dataverse SDK for Python (preview) patterns for connection setup, CRUD, pagination, and file uploads. CX Codex +1 ★ 41,430repo stars dataverse-python-best-practices official github dataverse-python-best-practices — a rule for GitHub Copilot with production patterns for Dataverse SDK for Python. Guides authentication setup, CRUD optimization, and SQL query construction following Microsoft's official recommendations. CX Codex +1 ★ 41,430repo stars dataverse microsoft Control Microsoft Dataverse and Dynamics 365 environments from Claude Code. Run queries, manage schema, import bulk data, and automate solution deployments. ★ 262repo stars test-data-generation aj-geddes test-data-generation generates realistic, consistent test datasets using factories, fixtures, and fake data libraries. Useful for database seeding and edge-case testing. CX Codex +1 505installs generate-data Paweł Huryn generate-data generates realistic mock datasets in CSV, JSON, or SQL using Python scripts with custom distributions and constraints. CX Codex +1 ★ 28,211repo stars

From the same set157

The whole set →
design-system Generates a Tamagui design system for Expo/React Native Power Apps: a spec in design-system.md, tokens in tokens.ts, and an HTML component gallery. CX Codex +1 ★ 1,167repo stars integrate-webapi integrate-webapi connects Power Pages Web API to site frontend code, configures Dataverse table permissions, and prepares deployment. CX Codex +1 ★ 1,167repo stars genpage-page-builder The genpage-page-builder subagent writes one .tsx file for a generative page in a Power Apps model-driven app. The genpage skill calls it after the page plan is ready. CX Codex ★ 1,167repo stars setup-pipeline setup-pipeline — a skill that configures Power Platform Pipelines for automated Power Pages solution deployments to staging and production. CX Codex +1 ★ 1,167repo stars genpage-planner The genpage-planner subagent checks a Power Platform environment and prepares a generative-page plan for a model-driven app. The /genpage skill calls it; users do not invoke it directly. CX Codex ★ 1,167repo stars test-site test-site runs a browser-based check on a live Power Pages site: loads pages, follows links, and inspects API responses. CX Codex +1 ★ 1,167repo stars setup-offline-profile setup-offline-profile configures a Dataverse Mobile Offline Profile for Power Apps mobile clients and writes offline-profile.json. CX Codex +1 ★ 1,167repo stars data-model-architect data-model-architect is a Claude Code subagent that proposes Dataverse schemas for native Power Apps projects. An orchestrator calls it during data-model planning. CX Codex ★ 1,167repo stars

Project sponsors

Companies that keep this analytics open