cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Strikerman10
Frequent Visitor

Patch update to SharePoint list on button

Hi, hoping someone can help because I just cannot work this out.  I am trying to patch an entry in my SharePoint list when I click a button.  The patched column is a Choice column with the values Yes, No, Rejected.  The button serves two purposes, 1) to create and PDF (this works) and 2) to update the Sharepoint list (this doesn't).  The formula I am using is:

 

WithdrawalPDF.Run(PDFExport.HtmlText, BrowseGallery1.Selected.'Apprentice Name Copy', "Leaver.html" & (UpdateContext({varShowPopup:true}))); Patch(Withdrawals,First(Filter(Withdrawals, SubmissionID=DataCardValue49)),{SentToMIS:{Value:"Yes"}})

 

The error is Invalid Argument Type.Icon1.OnSelect and I can see it is to do with the =.  Everything else seems to be accepted.  I cannot work out why the = is a problem.  Would be really grateful for any help!

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @Strikerman10 ,

Do you mean that your problem is this part "SubmissionID=DataCardValue49"?

Could you tell me:
1)what is the data type of this field SubmissionID?

2)what is the control that DataCardValue49 represents?

Please notice that : you could not directly compare a field with a control name.

You need to compare a field with the data in that control.

For example, if the control is textinput, data in that control should be represented by :

controlname.Text

 if the control is drop down, data in that control should be represented by :

controlname.Selected.fieldname

 

Let us back to your issue.

If  SubmissionID is number type, DataCardValue49 is text input, you should use this formula:

WithdrawalPDF.Run(PDFExport.HtmlText, BrowseGallery1.Selected.'Apprentice Name Copy', "Leaver.html" & (UpdateContext({varShowPopup:true}))); Patch(Withdrawals,First(Filter(Withdrawals, SubmissionID=Value(DataCardValue49.Text))),{SentToMIS:{Value:"Yes"}})

If  SubmissionID is text type, DataCardValue49 is text input, you should use this formula:

 

WithdrawalPDF.Run(PDFExport.HtmlText, BrowseGallery1.Selected.'Apprentice Name Copy', "Leaver.html" & (UpdateContext({varShowPopup:true}))); Patch(Withdrawals,First(Filter(Withdrawals, SubmissionID=DataCardValue49.Text)),{SentToMIS:{Value:"Yes"}})

 

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Drrickryp
Super User
Super User

@Strikerman10 

For one thing you have an extra }} in your Patch()

mdevaney
Super User
Super User

@Strikerman10 

Performance tip: don’t use this because it’s slower

 

First(Filter(Withdrawals, SubmissionID=DataCardValue49))

 

Use this instead:

 

LookUp(Withdrawals, SubmissionID=DataCardValue49)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

v-yutliu-msft
Community Support
Community Support

Hi @Strikerman10 ,

Do you mean that your problem is this part "SubmissionID=DataCardValue49"?

Could you tell me:
1)what is the data type of this field SubmissionID?

2)what is the control that DataCardValue49 represents?

Please notice that : you could not directly compare a field with a control name.

You need to compare a field with the data in that control.

For example, if the control is textinput, data in that control should be represented by :

controlname.Text

 if the control is drop down, data in that control should be represented by :

controlname.Selected.fieldname

 

Let us back to your issue.

If  SubmissionID is number type, DataCardValue49 is text input, you should use this formula:

WithdrawalPDF.Run(PDFExport.HtmlText, BrowseGallery1.Selected.'Apprentice Name Copy', "Leaver.html" & (UpdateContext({varShowPopup:true}))); Patch(Withdrawals,First(Filter(Withdrawals, SubmissionID=Value(DataCardValue49.Text))),{SentToMIS:{Value:"Yes"}})

If  SubmissionID is text type, DataCardValue49 is text input, you should use this formula:

 

WithdrawalPDF.Run(PDFExport.HtmlText, BrowseGallery1.Selected.'Apprentice Name Copy', "Leaver.html" & (UpdateContext({varShowPopup:true}))); Patch(Withdrawals,First(Filter(Withdrawals, SubmissionID=DataCardValue49.Text)),{SentToMIS:{Value:"Yes"}})

 

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanks @v-yutliu-msft 

 

It didn't quite work but I changed '=Value' in SubmissionID=Value to SubmissionID=Text(DataCardValue49.Text)) and now it is working.  It gave an error where it was Value as it said it could not evaluate where the left value is a Text type against a right value which is a Number type.

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 (1,180)