I-edit

dataApi reference for generative pages

When you generate a page using natural language, the AI creates a React page in TypeScript. The generated page covers both the front-end user experience by selecting the right components and determining the best layout, and the corresponding business logic.

You can view and edit the generated code to refine the output. Data operations use a dataApi object that exposes public methods grouped into these categories:

Category Description
Dataverse table methods Create, retrieve, update, and delete Dataverse table rows, and query choice columns.
Connector methods Work with data exposed by a Power Platform connector bound to the page.
Dataverse operation methods Invoke Dataverse custom APIs bound to the page as actions or functions.
Page methods Control the generative page itself, such as returning a value when the page is used as a dialog.

Connector methods and action and function methods are optional members of the dataApi contract. Some hosts don't implement them, so always check that a method exists (for example, if (dataApi.executeAction) { ... }) before calling it. A method being present doesn't mean the page has a connector or Dataverse custom API bound to it, or that the custom API is enabled or permitted for the current user. Handle unavailable functionality and custom API failures explicitly rather than assuming success.

Dataverse table methods

Use the Dataverse table methods of the dataApi object to create, retrieve, update, and delete Dataverse table rows, and query choice columns.

Method Description
createRow Creates a new row in the specified table.
deleteRow Deletes a row from the specified table.
getChoices Retrieves the choices for the specified choice column name.
queryTable Queries a table with the specified options.
retrieveRow Retrieves a row from the specified table with the specified options.
updateRow Updates an existing row in the specified table.

Connector methods

Use the connector methods of the dataApi object to work with data exposed by a Power Platform connector bound to the page.

Method Description
createConnectorRow Creates a new row in the specified connector table.
deleteConnectorRow Deletes a row from the specified connector table.
executeConnectorOperation Invokes a named operation exposed by a REST (operation-keyed) connector, such as Office 365 Users.
getConnectorSwagger Retrieves the Swagger (OpenAPI) definition for the connector.
getConnectorTableSchema Retrieves the schema for a table (also called an entity or list) exposed by the connector.
listConnectorDatasets Lists the datasets available for the connector.
listConnectorOperations Lists the operations exposed by a REST (operation-keyed) connector.
listConnectorTables Lists the tables available in the specified connector dataset.
queryConnectorTable Queries a table exposed by the connector with the specified options.
retrieveConnectorRow Retrieves a single row from the specified connector table.
updateConnectorRow Updates an existing row in the specified connector table.

Dataverse action and function methods

Use the action and function methods of the dataApi object to invoke Dataverse custom APIs bound to the page.

Method Description
executeAction Invokes a Dataverse custom API bound to the page as an action.
executeFunction Invokes a Dataverse custom API bound to the page as a function.
listBoundActions Lists the Dataverse custom APIs (actions and functions) bound to the page.

Page methods

Use the page methods of the dataApi object to control the generative page itself, such as returning a value when the page is used as a dialog.

Method Description
setPageOutput Sets the value returned to the calling script when a generative page dialog closes.