Cuir in eagar

Comhroinn trí


pac model

(Preview) Commands for working with model-driven apps.

Commands

Command Description
pac model genpage download (Preview) Pull generated pages from a model-driven app.
pac model genpage generate-types (Preview) Generates TypeScript schema definitions for data sources
pac model genpage list (Preview) Lists all generated pages in the specified model-driven app.
pac model genpage transpile (Preview) Transpiles a TypeScript file with runtime types for testing and debugging
pac model genpage upload (Preview) Upload and publish a generated page to a model-driven app.
pac model list (Preview) Lists all model-driven apps in the environment.
pac model list-languages (Preview) Lists enabled languages in the Dataverse environment.

pac model genpage download

(Preview) Pull generated pages from a model-driven app.

Required Parameters for model genpage download

--app-id

The ID of the model-driven app.

Optional Parameters for model genpage download

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--output-directory -o

Directory to save pulled pages. Defaults to current directory.

--page-id

Comma-separated list of page IDs to pull.

Examples

Download a single generative page by its page ID to a local folder for editing:

pac model genpage download \
  --app-id "a1b2c3d4-1234-5678-abcd-000000000001" \
  --page-id "e5f6a7b8-abcd-ef01-2345-000000000010" \
  --output-directory ./pages/account-dashboard

Download all generative pages in an app at once:

pac model genpage download \
  --app-id "Contoso Sales Hub" \
  --output-directory ./pages

The command creates a subdirectory named after the page ID and writes the following files:

./pages/account-dashboard/
  e5f6a7b8-abcd-ef01-2345-000000000010/
    page.tsx          ← TypeScript source code
    page.js           ← Transpiled JavaScript
    RuntimeTypes.ts   ← Dataverse type definitions
    config.json       ← Page metadata
    prompt.txt        ← Original generation prompt

pac model genpage generate-types

(Preview) Generates TypeScript schema definitions for data sources

Required Parameters for model genpage generate-types

--data-sources

Comma-separated list of data sources used (e.g., 'account,lead,contact').

Optional Parameters for model genpage generate-types

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--output-file -o

Path to save the generated TypeScript schema file (defaults to RuntimeTypes.ts)

Examples

Generate TypeScript types for the account and contact tables and write them to ./src/RuntimeTypes.ts:

pac model genpage generate-types \
  --data-sources "account,contact" \
  --output-file ./src/RuntimeTypes.ts

Generate types for a single table into a specific output directory:

pac model genpage generate-types \
  --data-sources "opportunity" \
  --output-file ./pages/opportunity/RuntimeTypes.ts

Note

Always run generate-types before writing page code that queries Dataverse tables. The generated file contains strongly-typed column names, foreign key fields, and enum values for each table. Relying on the generated types prevents runtime errors caused by misspelled or non-existent column names.

pac model genpage list

(Preview) Lists all generated pages in the specified model-driven app.

Required Parameters for model genpage list

--app-id

The ID of the model-driven app.

Optional Parameters for model genpage list

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

Examples

List all generative pages in the Contoso Sales Hub app using its app ID:

pac model genpage list --app-id "a1b2c3d4-1234-5678-abcd-000000000001"

List generative pages by app name (the CLI looks up the app ID automatically):

pac model genpage list --app-id "Contoso Sales Hub"

Sample output:

Found 2 generated page(s):

  Account Dashboard
    Page ID: e5f6a7b8-abcd-ef01-2345-000000000010
    Description: Created: 2026-01-15T10:22:00Z

  Opportunity Tracker
    Page ID: e5f6a7b8-abcd-ef01-2345-000000000011
    Description: Created: 2026-02-03T14:05:00Z

pac model genpage transpile

(Preview) Transpiles a TypeScript file with runtime types for testing and debugging

Required Parameters for model genpage transpile

--code-file

Path to the file containing the page code.

Optional Parameters for model genpage transpile

--data-sources

Comma-separated list of data sources used (e.g., 'account,lead,contact').

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--output-file

Path to save the transpiled JavaScript output (defaults to [code-file].compiled.js)

pac model genpage upload

(Preview) Upload and publish a generated page to a model-driven app.

Required Parameters for model genpage upload

--app-id

The ID of the model-driven app.

--code-file

Path to the file containing the page code.

Optional Parameters for model genpage upload

--add-to-sitemap

Add the page to the app's sitemap navigation.

This parameter requires no value. It's a switch.

--agent-message

The agent's response message.

--agent-message-file

Path to a file containing the agent's response message.

--compiled-code-file

Path to the file containing the compiled JavaScript code. If not provided, TypeScript will be automatically transpiled to JavaScript.

--data-sources

Comma-separated list of data sources used (e.g., 'account,lead,contact').

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

--model

The AI model used to generate the page (e.g., 'claude-3-5-sonnet-20241022').

--name -n

The name of the page.

--page-id

The ID of the page to update. If not provided, a new page will be created.

--prompt

The user prompt that generated this page.

--prompt-file

Path to a file containing the user prompt that generated this page.

Examples

Publish a new generative page to the Contoso Sales Hub app and add it to the app sitemap:

pac model genpage upload \
  --app-id "a1b2c3d4-1234-5678-abcd-000000000001" \
  --code-file ./pages/account-dashboard.tsx \
  --name "Account Dashboard" \
  --data-sources "account,contact" \
  --prompt "A dashboard showing Account records as interactive cards with contact count and revenue metrics." \
  --model "claude-sonnet-4-6" \
  --agent-message "Created account dashboard with card grid, revenue chart, and contact list. Uses account and contact tables." \
  --add-to-sitemap

Update an existing generative page by providing its page ID (omit --add-to-sitemap to avoid creating a duplicate sitemap entry):

pac model genpage upload \
  --app-id "a1b2c3d4-1234-5678-abcd-000000000001" \
  --page-id "e5f6a7b8-abcd-ef01-2345-000000000010" \
  --code-file ./pages/account-dashboard.tsx \
  --data-sources "account,contact" \
  --prompt "A dashboard showing Account records as interactive cards with contact count and revenue metrics." \
  --model "claude-sonnet-4-6" \
  --agent-message "Updated card layout to use a two-column grid; added revenue sparkline chart."

Publish a page that uses mock data (no Dataverse tables — omit --data-sources):

pac model genpage upload \
  --app-id "Contoso Sales Hub" \
  --code-file ./pages/welcome-screen.tsx \
  --name "Welcome" \
  --prompt "A branded welcome screen with Contoso logo, quick-action tiles, and a news feed placeholder." \
  --model "claude-sonnet-4-6" \
  --agent-message "Welcome page with static mock data. No Dataverse queries." \
  --add-to-sitemap

Tip

The --app-id parameter accepts either the app's GUID or its display name. If multiple apps share the same display name, use the GUID to avoid ambiguity. Run pac model list to look up app IDs.

Parameter quick-reference

Parameter Required Description
--app-id Yes App GUID or display name. Run pac model list to find it.
--code-file Yes Path to the .tsx source file to deploy.
--name New pages only Display name shown in the app sitemap.
--page-id Updates only GUID of the existing page to replace.
--data-sources Dataverse pages Comma-separated list of Dataverse table logical names (e.g. "account,contact").
--prompt Recommended Natural language summary of what the page does. Stored for regeneration context.
--model Recommended Model ID used to generate the page (e.g. claude-sonnet-4-6).
--agent-message Recommended Description of what was built or changed. Stored as change history.
--add-to-sitemap New pages only Adds the page to the app navigation automatically. Omit when updating.

pac model list

(Preview) Lists all model-driven apps in the environment.

Optional Parameters for model list

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

Examples

List all model-driven apps in the currently active environment:

pac model list

Sample output:

Found 3 model-driven app(s):

  Contoso Sales Hub
    App ID: a1b2c3d4-1234-5678-abcd-000000000001
    Unique Name: contoso_SalesHub

  Contoso Field Service
    App ID: a1b2c3d4-1234-5678-abcd-000000000002
    Unique Name: contoso_FieldService

  Contoso Customer Portal
    App ID: a1b2c3d4-1234-5678-abcd-000000000003
    Unique Name: contoso_CustomerPortal

pac model list-languages

(Preview) Lists enabled languages in the Dataverse environment.

Optional Parameters for model list-languages

--environment -env

Specifies the target Dataverse. The value may be a Guid or absolute https URL. When not specified, the active organization selected for the current auth profile will be used.

See also

Microsoft Power Platform CLI Command Groups
Microsoft Power Platform CLI overview