I have a bunch of If checks at a form submission to determine if fields have been modified. I'm sure there are better ways to do this but I have this working for all but one field which is a choice field. I cannot for the life of me figure out how to do the comparison.
Here is my code (I know it's currently wrong. I can't compare a text string to a record but removing the .DisplayName on the left to compare records fails. And I can't use .DisplayName on the datacard default which is also referencing a user from a choice list.
If(
DataCardValue12.Selected.DisplayName <> crdAssignedUser2.Default, // Check if the Assigned To has been changed
Patch(
ActEntry, // Specify the target data source (ActEntry table)
Defaults(ActEntry), // Create a new record
{
TicketNumber: RequestID, // Use the same TicketID formula the Details Form does
Activity: "Assigned",
Entry: DataCardValue12.Selected.DisplayName, // Write the new value of the Assigned To
Datetime: Now(),
User: User().FullName
}
)
);
DataCardValue12.Selected <> crdAssignedUser2.Default doesn't work. This one doesn't show an error on either side but it shows error at the <>.
DataCardValue12.Selected.DisplayName <> crdAssignedUser2.Default.DisplayName doesn't work. The right side shows an error for .DisplayName. Although that Default is a record that does resolve to a user, I can't get 'inside' the record to do the comparison here.