cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CWileyRRT
Helper IV
Helper IV

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

@CWileyRRT 

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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

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

@CWileyRRT 

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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

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

RandyHayes
Super User
Super User

@CWileyRRT 

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.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

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

RandyHayes
Super User
Super User

@CWileyRRT 

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.
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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,610)