web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do I patch a field...
Power Apps
Answered

How do I patch a field of text type to a column of type choice in dataverse

(0) ShareShare
ReportReport
Posted on by 77

Hi there, 

 

I have a collection like the following: 

 

ClearCollect(
AllShoutOutTypes,
{
PrimaryId: 1,
Type: "Helpful Feedback",
Shoutout_Color: "#2E3192",
Description: "The Helpful Feedback shoutout badge is given to the person who gave critical insight on another person's work.",
Icon: Helpful,
Icon_Color: Helpful,
Selected: false
},
{
PrimaryId: 2,
Type: "New Perspective",
Shoutout_Color: "#F69679",
Description: "The New Perspective shoutout badge is given to the person who suggested a beneficially fresh view and/or direction to their teammates' work.",
Icon: New_Perspective,
Icon_Color: New_Perspective,
Selected: false
},
{
PrimaryId: 3,
Type: "Team Player",
Shoutout_Color: "#FFD700",
Description: "The Team Player shoutout badge is given to the student who collaborates well in group activities.",
Icon: team,

})

 

The field called type is a text column here. However, on my dataverse table it is a choice column. I am having trouble patching the text to a choice column. See below. The error I get is an OptionSetValue type error where it receives text. 

 

Set(_sendShoutout, true);

If(_sendShoutout,
// Write to data source
Patch(ShoutOuts, Defaults(ShoutOuts),
{
'Student ID' : LookUp(BSKL_Users,ID = ComboBox3.Selected.ID),
Description: TextBox5.Value,
Type: TemplateGalleryList1.Selected.Type
}
)
)

 

Is there a way around this? 

 

Categories:
I have the same question (0)
  • AARON_C Profile Picture
    2,235 Most Valuable Professional on at

    Hi @lmcc,

     

    Can you try this:

    Patch(
     ShoutOuts, 
     Defaults(ShoutOuts),
     {
     'Student ID' : LookUp(BSKL_Users,ID = ComboBox3.Selected.ID),
     Description: TextBox5.Value,
     Type: Text(TemplateGalleryList1.Selected.Value)
     }
    )

     

    Please tick Accept as solution if the answer is useful.

    Thanks,

    @AARON_C 

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @lmcc ,

     

    I made a sample for you.

    vxiaochenmsft_0-1698806851727.png

     

    AddColumns( Choices(Table6S.TestChoice),"temp",Text(Value))

     

    vxiaochenmsft_1-1698806869151.png

     

    Patch(Table6S,Defaults(Table6S),{Test2:"AAB",Type:"AAB", TestChoice: Gallery1.Selected.Value})

     

     

    Please try this in your case

    Set(_sendShoutout, true);
    
    If(_sendShoutout,
    // Write to data source
    Patch(ShoutOuts, Defaults(ShoutOuts),
    {
    'Student ID' : LookUp(BSKL_Users,ID = ComboBox3.Selected.ID),
    Description: TextBox5.Value,
    Type: LookUp( AddColumns( Choices(ShoutOuts.Type),"temp",Text(Value)),temp= TemplateGalleryList1.Selected.Type ).Value 
    }
    )
    )

     

    Best Regards,

    Wearsky

  • lmcc Profile Picture
    77 on at

    @v-xiaochen-msft Thank you for your solution. Unfortunately, it doesn't work. It now presents an error where crfc_type is required when I click the submit button. 

     

    Does this mean it's not fetching the value in the lookup function?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 333 Most Valuable Professional

#2
11manish Profile Picture

11manish 184

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 86 Super User 2026 Season 1

Last 30 days Overall leaderboard