cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
adaptivecruise
Level: Powered On

Need a button to change currently selected SharePoint list item

Hello everybody.

 

I'm working on an app that is for fairly simple workflows. Users fill out all the required info on one page and then, once submitted, can access a page with a summary of the workflow they submitted. 

 

On this summary page I have a gallery displaying bits of info from each of the submitted workflows. They each have a unique, incremented ID, a name, etc. If the user wants more info they can click on the gallery item and on the right side of the page a display form shows all the rest of the information pertinent to this particular workflow.

 

What I'm trying to do (and failing) is, with a button, I want a user to be able to basically close a workflow once everything has been completed. I've built the logic so that the button only shows up if all of the approvals have been collected, but now I need to change the SP list item's status column to "Completed" when the user presses this button.

 

I've tried various iterations of the patch function, and it's kind-of working, but it's not changing the column status of the selected workflow item to "Completed", instead creating a new line in SP and inserting "Completed" into the status column.

 

Does anyone know how to patch to a list, but to the specifically selected gallery item that's currently on display?

 

Daniel 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
KOM_4410
Level 8

Re: Need a button to change currently selected SharePoint list item

Hi Daniel, try:

 

Patch(name_of_the_list,LookUp(name_of_the_list,ID=IDControlName.Text),{StatusColumnName: "Completed"})

View solution in original post

6 REPLIES 6
KOM_4410
Level 8

Re: Need a button to change currently selected SharePoint list item

Hi Daniel, try:

 

Patch(name_of_the_list,LookUp(name_of_the_list,ID=IDControlName.Text),{StatusColumnName: "Completed"})

View solution in original post

Microsoft Michael
Microsoft

Re: Need a button to change currently selected SharePoint list item

Also, if you can share the Patch() call you are using and any errors you are encountering, it will help to debug any specific issues you are encountering.

adaptivecruise
Level: Powered On

Re: Need a button to change currently selected SharePoint list item

Hello KOM_4410,

 

Thanks for your help. Here's the code I've tried:


Patch(CAM_WorkflowData, LookUp(CAM_WorkflowData, CAMIncrementedID=DataCardValue2.Text), {Status:"Completed"})

 

This actually seems to be working, but I've got one of those little blue circles

"The values being compared have mismatched typed (left is Number and right is Text). Please check for logical and syntatic errors, and use parentheses to provide explicit logical grouping."

 

I believe the reason for this is that my ID column in my list (CAM_WorkflowData) is a number column, but I think my form is displaying the value as text.

 

Is it okay to have blue circles like this if everything is working?

 

Again, thank you for your help!

 

Daniel

adaptivecruise
Level: Powered On

Re: Need a button to change currently selected SharePoint list item

Hello Michael,

 

Thank you for chiming in as well. KOM_4410's solution worked for me, but I was wondering if you could look at my reply to them?

 

I'm getting a small blue circle issue and although things are working now, I'm wondering if having this blue circle error is going to cause problems down the road?

 

Thanks so much for helping me out.

Microsoft Michael
Microsoft

Re: Need a button to change currently selected SharePoint list item

The blue circle is a warning because the type mismatch you identified could cause ambiguity in the future. To help protect against this, you can wrap either the text with a Value() function to convert it to a number or wrap the ID with a Text() function to convert it to text. This should get rid of the warning and ensure that the comparison does not have issues in the future.

adaptivecruise
Level: Powered On

Re: Need a button to change currently selected SharePoint list item

Awesome. This worked like a charm. My blue circle is gone.

 

Can't thank you enough. PowerApps is incredible and I'm in love with it. I just need more knowledge. Haha.

 

Daniel

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (2,779)