Connect Code Apps to Dataverse

Connect Code App to Dataverse

Enables developers to connect Power Apps code apps to Microsoft Dataverse using the Power Apps SDK.

Prerequisites:

• Power Apps code apps SDK @microsoft/power-apps npm package

• Power Apps CLI (PAC CLI) version 1.46 or later

• An environment with Dataverse enabled

• Active PAC CLI connection


Steps:

1. Ensure you're connected to your environment using PAC CLI.

2. Use the pac code add-data-source command to add Dataverse as a data source to your code app. Replace <table-logical-name> with the logical name of the Dataverse table.


Data Operations & Limitations:

• Ensure Power Apps SDK initialization before performing data operations

• Use generated Model and Service files from /generated/services/

• Create records:

  – Use generated models

  – Exclude system-managed and read-only fields

• Read records:

  – Retrieve single records using primary key

  – Retrieve multiple records using configurable query options

  – Always limit columns using select

• Update records:

  – Include only changed fields to avoid false updates

• Delete records:

  – Requires primary key value


Unsupported Scenarios:

• Polymorphic lookups

• Dataverse actions and functions

• FetchXML and alternate key support

• Schema metadata CRUD

• Deleting Dataverse data sources via PAC CLI


Related Information