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

Submit form to SharePoint list and update status

I have a form that uses a SharePoint list as a data source. Here's the desired scenario:

  1. User completes the form and clicks "Submit" button
  2. A new SharePoint list item is generated (I can do this with SubmitForm)
  3. A choice field on the list item, named "Status," is updated to "Ready for review". Note the Status field is not visible on the user-facing form. (Do I do this with Patch?)

Can someone help me do this? I have read several posts and have not been able to figure it out.

form submit status update diagram.png

6 REPLIES 6
Super User
Super User

Re: Submit form to SharePoint list and update status

Yes you would do it with patch.  Use something like the following patch statement

Patch(Quests,Defaults(Quests),{Title:"Test Update",Status:{Value:"Ready for Review"}})

I don't see them in your screenshot, but if you want to include the values from the dropdowns you will add those fields and values into the patch statement above. The piece that needs explaining here is that the Status column is a choice field so it expects a record as its value rather than just text.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
aaronspencer
Level: Powered On

Re: Submit form to SharePoint list and update status

Thank you for your reply. Can you please clarify a few points?

  • Are you saying that your "Patch...Defaults" snippet would create a new list item that contains the info the user entered into the form? My form contains more fields than those shown in my screenshot, such as "Title," "Summary," "Owner," etc. With your snippet, would I also need to code records/values for each field instead of using SubmitForm?
    quests form.pngFull form
  •  In your snippet, looks like it will enter text, instead of a choice, for Status. Maybe I misunderstand you.
    Status:{Value:"Ready for Review"}
    Status is a choice field, so how do I configure it for the choices?
    Status choice field.pngStatus choice field in SharePoint form
Super User
Super User

Re: Submit form to SharePoint list and update status

Yes the Patch statement I supplied will create a new record, but no it won't include the information on your form unless you add those fields to the Patch statement. But you also need to create columns in the SharePoint list for each of the fields on the Form.  Otherwise there is nowhere to save them to.  You screen shot only showed the Title and Status fields so that was all I included in the Patch statement.  

 

The status field is setting the Value of the Choice field selected in the Record equal to the text of the Choice field.  That's why its formatted as a record and not a simple text field.  That is the way you configure it to select a specific choice in the choice field.

 

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: Submit form to SharePoint list and update status

Hi @aaronspencer ,

Could you please share a bit more about your scenario?

Do you want to create a new item in your SP list via submitting your form data, and then update the Status column to "Ready for review" automatically?

 

Based on the issue that you mentioned, I think the OnSuccess property of your Edit form and a Patch function could achieve your needs.

On your side, please add the following formula within the OnSuccess property of your Edit form:

Patch(
          'YourSPList',
           EditForm1.LastSubmit,          /* <-- EditForm1 represents the Edit form in your app */
           {
              Status: {
                           Value: "Ready for review"
                      }
           }
)

Or

Patch(
          'YourSPList',
           LookUp('YourSPList', ID = EditForm1.LastSubmit.ID),          /* <-- EditForm1 represents the Edit form in your app */
           {
              Status: {
                           Value: "Ready for review"
                      }
           }
)

When you press the "Submit" button to execute the SubmitForm() function successfully, the OnSuccess property of the Edit form would be fired, so the above Patch would be executed.

 

In additon, when load Status column (Choice type) values from your SP list into PowerApps app, the Choice type column would be displayed as a Object/record value, the standard format of the Object/record value as below:

{
   Value: "xxx"
}

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

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

Re: Submit form to SharePoint list and update status

Alternatively in SharePoint, set the default value of the "Status" column to "Ready for review". I suspect the column would need to be optional otherwise PowerApps will generate an error when you submit the form unless you populate that value in a datacard you mark as hidden (such that users thus won't see it).

Super User
Super User

Re: Submit form to SharePoint list and update status

Just make your Default  Ready for Review  on your Sharepoint list if that is what you want the first status on a new entry to be and then you don't even need the Status card in your form and for sure don't need Patch or anything.

 

Keep it simple when you can.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 102 members 4,202 guests
Please welcome our newest community members: