web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to update Sharepoi...
Power Apps
Unanswered

How to update Sharepoint list item when a form button is clicked

(0) ShareShare
ReportReport
Posted on by 21

Hi,

 

I'm new to powerapps and I'm designing a leave request form and a flow based on a Sharepoint list.

I desgined the form by clicking PowerApps->Customize forms

 

Below are the requirements

1. Save the form data to SP list when the user clicks the "Save" button and update the Sharepoint List Column "Status" to "Draft"

2. Save the form data to SP list when the user clicks the "Submit" button and update the Sharepoint List Column "Status" to "Submitted"

3. Update the Sharepoint List Column "Status" to "Cancelled" when the user clicks the "Cancel" button.

 

The user may save the form data first and later come and submit it for approval.

 

I tried the patch function for the Cancel button, but it gives an error

Patch.PNG

 

Could someone help me on how to achieve the above three requriements.

 

Form.PNG

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,925 on at

    Try:

    Patch('Leave Request', First( Filter('Leave Request', Title = TitleDataCardValue.Text ) ),

    { Status:"Cancelled"})

     

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Rana1 ,

    Could you tell me

    1)the "Status" field's data type?

    2)the choices of "Status" field, are they: "Draft", "Submitted" and "Cancelled"?
    I assume that this field is a choice field.

    If so, try this:

    1)set save button's OnSelect:

    SubmitForm(Formname);
    Patch(listname,SharePointIntegration.Selected,{Status:{Value:"Draft"}})
    //please replace with your formname, listname

    2)set submit button's OnSelect:

     

    SubmitForm(Formname);
    Patch(listname,SharePointIntegration.Selected,{Status:{Value:"Submitted"}})
    //please replace with your formname, listname

     

    3)set cancel button's OnSelect:

    Patch(listname,SharePointIntegration.Selected,{Status:{Value:"Cancelled"}})

     

    Please notice that

    1)you need to use {Value:...} to update a choice field.

    2)you need to use SharePointIntegration.Selected to represent the selected item of this list.

     

    Best regards,

  • Rana1 Profile Picture
    21 on at

    Hi @v-yutliu-msft ,

     

    Thanks for your reply.

     

    1. My "Status" field is a single line text field. 

    2. The choices for the field are Draft,Pending Approval,Approved,Rejected and Cancelled. 

     

    Your suggestion did work for Save and Cancel buttons.

     

    For the Submit button I have the  requirement  to update the Status as "Pending Approval" when the user clicks Submit button. This worked when the user first saves the form and comes back and submits it. But the Status didn't update when a user Submitted a new form directly without saving. Is there a way to update the Status when the user directly Submits the form?

     

    I used the below formula :

     

    SubmitForm(SharePointForm1);Patch('Leave Request',SharePointIntegration.Selected,{Title:"Click Here",Status:"Submitted"});RequestHide()

     

    Regards,

    Rana1

  • Rana1 Profile Picture
    21 on at

    Hi @eka24 ,

     

    Your solution too worked for the "Cancelled " status and thanks for that. But I faced the same issue here also as the Status didn't update for newly created items when the form was submitted directly without saving. The Status updated correctly when a user opened a saved item and clicked Submit button. 

     

    I used the below formula for the Submit button .

     

    SubmitForm(SharePointForm1);Patch('Leave Request',First(Filter('Leave Request',Title=DataCardValue1.Text)),{Status:"Submitted"});RequestHide()

     

    I guess the issue is "Title " field doesn't returns a value as  record is created for the first time. But this works once a record it created , because a value is returned for the Title.

     

    Any idea how I can achieve this for newly created items. 

     

    regards,

    Rana1

  • abcrandy Profile Picture
    42 on at

    @Rana1 Did you ever find a solution to this issue for newly created items?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 915

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 457

Last 30 days Overall leaderboard