Study FAQ
How do I call a Dataverse action or function from a Power Apps code app?
Also asked as 2
- How do I discover a Dataverse operation and generate its service in a code app?
- How do I add WhoAmI or a bound Dataverse action to a Power Apps code app?
Answer
Use Power Apps CLI to discover the Dataverse operation in the configured environment and generate its TypeScript service. With an initialized code app and @microsoft/power-apps version 1.1.1 or later, you can start with the unbound WhoAmI function:
pa app find-dataverse-api --search "WhoAmI"
pa app add dataverse-api --api-name WhoAmI
Import the generated WhoAmIService and call WhoAmIService.WhoAmI(). Check the generated response and verify that it identifies the intended development user and organization. For a bound action such as AddToQueue, inspect the bind target, required parameters and return type. The generated signature for that action takes the binding row ID first.
When an operation definition changes, add the same operation again to update the generated contract. Review the diff and retest callers with the intended user. Verify a business action's actual outcome and permission checks independently of the identity returned by WhoAmI.
Full explanation
AB-400: Building Code Apps with Dataverse and Automation
Study guide · AB-400
Read the full explanation