cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ebigelow
New Member

Update a SharePoint item

I am making a Loss Control Dashboard for my company, it is very similar to the out of the box Service Desk. The Loss Control Requests are submitted through a Microsoft Form and saved to a SharePoint list. I figured out how to sort the requests by status. I am trying to figure out how to update an item and have it update the item on the SharePoint list. For example, I want to be able to add notes and have it update the SharePoint.

 

I tried to make this happen by using a Save button:

 

If(LabelStatus.Text<>"Closed",
UpdateIf('Loss Control',ID=editrecord.ID,{Status:LabelStatus.Text,'Coverage: Workers Comp':TextInputWC.Text,'Coverage: General Liability':TextInputGL.Text,'Coverage: Auto':TextInputAuto.Text,'Coverage: Property':TextInputProp.Text,Notes:TextInputNotes.Text}),
UpdateIf('Loss Control',ID=editrecord.ID,{Status:LabelStatus.Text,'Coverage: Workers Comp':TextInputWC.Text,'Coverage: General Liability':TextInputGL.Text,'Coverage: Auto':TextInputAuto.Text,'Coverage: Property':TextInputProp.Text,Notes:TextInputNotes.Text}));
Navigate(Home,
ScreenTransition.Fade)

 

But it doesn't update the list and applies the text to all of the items in the app.

2 ACCEPTED SOLUTIONS

Accepted Solutions
MagnusGöransson
Kudo Collector
Kudo Collector

I would recommend looking into "Patch" and use that instead of "UpdateIf".

 

Patch(Datasource,gallery1.selected,{'column to update':"value to update"})

 

That is quite straigth forward.

View solution in original post

v-jefferni
Community Support
Community Support

Hi @ebigelow ,

 

I don't see any difference between the two UpdateIf functions, for your scenario, if you are using Edit Forms on that screen, you could use 

SubmitForm(Form1, Form2)

as well, then OnSuccess of the the Form use Patch to update additional info such as Status and Due Date in this case:

Patch('Loss Control', Form.LastSubmited, {Status:LabelStatus.Text, 'Due Date': LabelDueDate.Text})

 

If you are not working with Forms, note that you are only wanting to update the single record selected from the Gallery, Patch or Update is enough to achieve that need. And since the two functions would update the data source with current values, in your case the StatusLabel.Text, the If statement at the beginning is unnecessary.

 

Please refer to official doc that about functions for updating:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

2 REPLIES 2
MagnusGöransson
Kudo Collector
Kudo Collector

I would recommend looking into "Patch" and use that instead of "UpdateIf".

 

Patch(Datasource,gallery1.selected,{'column to update':"value to update"})

 

That is quite straigth forward.

v-jefferni
Community Support
Community Support

Hi @ebigelow ,

 

I don't see any difference between the two UpdateIf functions, for your scenario, if you are using Edit Forms on that screen, you could use 

SubmitForm(Form1, Form2)

as well, then OnSuccess of the the Form use Patch to update additional info such as Status and Due Date in this case:

Patch('Loss Control', Form.LastSubmited, {Status:LabelStatus.Text, 'Due Date': LabelDueDate.Text})

 

If you are not working with Forms, note that you are only wanting to update the single record selected from the Gallery, Patch or Update is enough to achieve that need. And since the two functions would update the data source with current values, in your case the StatusLabel.Text, the If statement at the beginning is unnecessary.

 

Please refer to official doc that about functions for updating:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,767)