Guide to Patching Complex Data Types in PowerApps with Dataverse

Guide to Patching Complex Data Types in PowerApps with Dataverse

Guide to Patching Complex Data Types in PowerApps with Dataverse

PowerApps, with its Dataverse integration, offers a powerful platform to manipulate and manage data. While some operations are intuitive, patching certain data types in Dataverse may present complexities. This article aims to simplify this task, focusing on some of the most intricate data types: lookup, choice, yes/no, and user columns.

While the Patch function is fundamental for adding or updating individual records in a data source, its application can differ significantly based on the type of data being handled. This comprehensive guide breaks down the nuances of patching these different data types.

Understanding Dataverse Data Types

Before delving into patching specifics, it’s essential to have a grasp of Dataverse data types. While many data types, like email URL and phone number, behave as strings, others, like whole numbers and date time groups, are treated as numbers and dates. However, the complexity arises with the unique data types such as choice, lookup, and customer columns.

Patching Examples Using a Dataverse Table

Consider a Dataverse table that contains columns such as Property (a lookup to the property table), DocumentType (a choice column), and others. We’ll explore how to effectively patch these columns.

1. Lookup Column

For lookup columns, the assigned record originates from the associated table. A typical patch operation to set the property lookup value might look like this:

Patch(PropertyDocs, Defaults(PropertyDocs), {Title: "Contract Doc", Property: LookUp(RealEstateProperties, Address="10 High Street")})

2. Choice Column

Choice columns in PowerApps expose all possible values through an enumeration. To set a column’s value, reference the specific choice:

Patch(PropertyDocs, Defaults(PropertyDocs), {Title: "Contract File", DocType: DocType.PDF})

3. Choices Column

For multi-value choices columns, assign an array of values:

Patch(PropertyDocs, Defaults(PropertyDocs), {Title: "Contract File", Permissions: [Permissions.'Web Share', Permissions.'Customer Share']})

4. Yes/No Column

Patch a boolean value for Dataverse’s yes/no fields:

Patch(PropertyDocs, Defaults(PropertyDocs), {Title: "Contract File", ContainsSensitiveInfo: true})

5. Customer Column

The customer column can link to records from either the Account or Contact tables. Patching this type of column involves:

Patch(PropertyDocs, Defaults(PropertyDocs), {Title: "Contract File", AgentInfo: LookUp(Clients, 'Client Name'="ACME Corp")})

6. User Columns

To patch a user column, reference the user table in Dataverse by email address:

Patch(PropertyDocs, Defaults(PropertyDocs), {Title: "Contract File", Approver: LookUp(AppUsers, 'UserEmail'="[email protected]")})


Efficiently utilizing the Patch function with PowerApps’ Dataverse involves understanding the intricacies of different data types. This guide seeks to demystify the process, ensuring seamless data management. For any further questions or technical assistance, don’t hesitate to contact us – we’re here to help and ensure your PowerApps journey is smooth.

About The Author