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
Could someone help me on how to achieve the above three requriements.
@Rana1 Did you ever find a solution to this issue for newly created items?
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
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
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,
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.
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional