Patching Complex Dataverse columns in Power Apps is essential as transitioning from SharePoint lists to Dataverse tables becomes more common. The column types in Dataverse may have the same names, but the patch techniques are significantly different. This article aims to guide the patching of single choice, multiple choice, lookup, and yes/no fields in Dataverse, noting the unique characteristics of each column type.
Patching complex column types in Dataverse is an essential skill for Power Apps users, as it allows for the customization and management of data within applications. This process entails transferring changes or updates from your Power Apps' user interface to the underlying Dataverse database. As Dataverse becomes a more common destination for data migration, especially from SharePoint, knowing how to manipulate its different column types—such as single and multiple choice items, lookups, and yes/no fields—is crucial.
It's important to note that while Dataverse shares some similarities with SharePoint, the methods for patching differ, requiring users to adapt their approaches. For instance, Dataverse has unique ways of handling choice sets and does not support a direct 'Person or Group' column type. Through a combination of dropdowns, combo boxes, and precise Power Fx code, users can effectively manage complex column types. Craig White's tutorial serves as an invaluable tool for those looking to master these techniques and optimize their use of Power Apps with Dataverse.
Following the article on patching complex column types in SharePoint, I explored the adaptation of these methods for Dataverse. Transitioning from SharePoint lists to Dataverse tables is prevalent, and it’s crucial to grasp the distinct patching techniques required for different column types. While both feature similar column types, the techniques applied in Dataverse are unique and essential to learn.
This article delves into how to patch various field types like single choice, multiple choice, lookup, and yes/no fields in Dataverse. Notably absent is the ‘Person or Group’ column found in SharePoint, but there are alternative methods to handle similar functionality.
The explanations provided are supported by a Dataverse table I created known as Patch Complex DVS. For those who are newer to Dataverse, the table setup process may seem different. Therefore, I will elaborate on this aspect further.
When adding a 'Choice' field type in Dataverse, you are presented with an option of syncing with a global choice or not. Global choices are advantageous when consistent options are needed across multiple environments. Alternatively, local choices are specific to the table and column at hand.
If you opt out of using a global choice, you can immediately add custom entries. This simplicity mirrors the process of setting up a SharePoint choice column. If you choose to use a global choice, you can either select an existing set or create a new one. These distinctions are key when patching these column types, a topic I will cover shortly.
For exemplification, I created two choice columns, 'ChoiceSingle' and 'ChoiceMulti.' Both columns utilize the same global choice set, with the only difference being that the 'ChoiceMulti' column has multiple selections enabled.
Lookup columns in Dataverse operate similarly to SharePoint. You choose the table to look up to and configure it accordingly. In my example, I used the Account table with some mock entries to demonstrate how this works.
Yes/no fields in SharePoint take boolean values. Interestingly, in Dataverse, despite appearing like a choice column with preset 'yes' or 'no' options, they can still accept boolean values when patching.
Although there's no direct 'Person or Group' column in Dataverse, we can replicate this functionality through a lookup column directed towards the Microsoft Entra ID table (previously known as AAD Users). However, this will only accept a single person, with no option to include multiple users.
Consideration for a solution that supports a multi-person picker within Dataverse applications is underway, with a detailed discussion expected in an early 2024 article.
For the 'Single Choice' column, a drop-down control named 'dpdChoiceSingleDV' is adjusted to ensure that it binds to the choice set created. The 'Items' property of this control then aligns with the global choice set, allowing the proper value to be patched.
For 'Multiple Choice,' a combo box named 'cmbChoiceMultiDV' follows a similar setup, referencing the relevant choice set and using 'SelectedItems' for patching since it involves multiple values.
In both these cases, the fundamental logic is connected to combo box controls named 'cmbLookupDV' and 'cmbPersonDV' respectively. The selected record from these controls helps patch the relevant columns in Dataverse.
When no controls are utilized, manual lookups to the correct table are necessary, ensuring the specific or entire record is fetched for patching.
To address Yes/No columns, a drop-down named 'dpdYesNoDV' is used. Direct referencing of the control with '.Selected.Value' allows the chosen value to be patched. However, direct boolean values are also an acceptable method to patch these types of columns.
The intricacies of patching complex Dataverse columns with Power Apps require attention to the unique properties and limitations of the system. These detailed explanations serve as a guide for those familiar with SharePoint looking to make the switch to Dataverse efficiently.
Use this method to update a lookup column by providing a record reference.
Patch( YourDataSource, YourRecordReference, { 'LookupColumnName': LookUp(OtherDataSource, ConditionToIdentifyRecord) } );
For a choice column, provide a record with a specific structure.
Patch( YourDataSource, YourRecordReference, { 'ChoiceColumnName': { 'Value': "YourChoiceValue" } } );
Multi-select choice columns require an array of choice values.
Patch( YourDataSource, YourRecordReference, { 'MultiSelectColumnName': { 'Value': [ { 'Value': "Choice1" }, { 'Value': "Choice2" } ] } } );
Read the full article Patch Complex Dataverse Columns With Power Apps
Dataverse Patch Function, Power Apps Column Update, Power Apps Dataverse Integration, Update Complex Columns PowerApps, PowerApps Dataverse Patch Method, Complex Column Types Patching, Patch Multiple Columns PowerApps, Power Apps Data Patch Technique, Complex Entity Patch PowerApps, PowerApps Dataverse Field Update