cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Patch Choice Field Not Working

I am trying to patch to a SharePoint List with a Choice Column. It works throughout the rest of my app but the same code isn't working here for some reason.

 

The highlighted section is the part that wont work. I have a drop-down field called ApprovalNeededInput which pulls the options from the list just fine. Neither option will write to the list.

 

Patch('Retired Documents', Defaults('Retired Documents'),{Title: Text(RetiredTitleInput)}, {Reason: Text(RetiredReasonInput)}, {'Approval Required': ApprovalNeededInput.Selected}; {'Requested By':{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & RetiredRequesterInput.Selected.Mail,
Department: "",
DisplayName: RetiredRequesterInput.Selected.DisplayName,
Email: RetiredRequesterInput.Selected.Mail,
JobTitle: "",
Picture: ""
}}; {Approvers: ApproversCollection}, Form1.Updates)

7 REPLIES 7
RandyHayes
Super User
Super User

@Anonymous 

Since this is tied to a form, this should all be in the form and a SubmitForm(Form1) should be all you need.

If there any particular reason to not do this?  A problem you ran into by doing it perhaps?

 

What is the Items property of the ApprovalNeededInput control?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

Its not tied to a form. I have an attachment field that shows up as a form element and adds attachments to the SPList item.

RandyHayes
Super User
Super User

@Anonymous 

If the attachments are intended for the datasource and record you are Patching, then it should all be part of the form and the SubmitForm function should be used.

 

But again - What is the Items property of the ApprovalNeededInput control?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

ApprovalNeededInput gets 2 choice options from the Approval Required column options in the SharePoint list.

RandyHayes
Super User
Super User

@Anonymous 

What is the formula on the Items property of the ApprovalNeededInput control?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

Choices('Retired Documents'.'Approval Needed')

RandyHayes
Super User
Super User

@Anonymous 

Okay...needed to make sure you were using that function - you had stated it got two choice options...made me think there was some filtering going on there.

 

Please consider changing your Formula to the following:

Patch('Retired Documents', 
    Defaults('Retired Documents'),
    {Title: RetiredTitleInput.Text, 
     Reason: RetiredReasonInput.Text, 
     'Approval Required': ApprovalNeededInput.Selected,
     'Requested By':
         {
           Claims: "i:0#.f|membership|" & Lower(RetiredRequesterInput.Selected.Mail),
           Department: "",
           DisplayName: RetiredRequesterInput.Selected.DisplayName,
           Email: RetiredRequesterInput.Selected.Mail,
           JobTitle: "",
           Picture: ""
         },       
      Approvers: ApproversCollection
    }, 
    Form1.Updates
)

You have a variety of mismatched semicolons and commas in your posted formula, so I am not sure exactly what you have for the ApproversCollection.

You were also trying to convert a control to text   i.e.  Text(RetiredTitleInput) 

You need to reference the control property that contains the value you want  i.e. RetiredTitleInput.Text

 

And again, this should really be incorporated into Form1 and be done with a SubmitForm(Form1)

But, the above should get the basics working.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (1,880)