cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
adstar22
Helper I
Helper I

Sharepoint List record update FROM powerapps collection - or multiple forms

I am really struggling with a utility which displays varying pieces of information across multiple forms/screens, navigated dependent on user selection.

 

My objective is to have a new item or modified item trigger a workflow.

 

During my trial and development, I have been able to update a sharepoint entry by using the formsubmit command. But I would have to do that for each page of the form it seams. when what I REALLY want to be able to do, is

a) collect data from the forms/screens into a collection

b) submit the new item or updated item as a single "event" which triggers the workflow(s)

 

I have managed to create my collection (colItem), and extracted data into it.

I can differentiate between a new and existing item based on the presence of an ID (First(colItem).ID)

 

But, what I am currently able to do is:

1) Identify the matching sharepoint record, based on the ID (struggling with syntax)

2) update or Patch the submitted changes from my collection into my list

 

Code I have tried:

If(IsEmpty(colItem.UID),"true",Patch('Sys Inventory AW',First(Filter('Sys Inventory AW',ID=First(colItem).UID))))

If(IsEmpty(colItem.UID),"true",Update('Sys Inventory AW',Filter('Sys Inventory AW',ID=First(colItem.UID)),First(colItem)))

 

Where colItem is my collection

UID is the item ID in my collection

Sys Inventory AW is my sharepoint list

ID is the item ID in sharepoint

 

I think I'm am on the right track (I hope) but I am REALLY struggling with the syntax.

I am also wondering if I am referring to the collection correctly. But that is another issue for another day!

1 ACCEPTED SOLUTION

Accepted Solutions

Problem solved! At last!!! Although... I now feel that the heading for this post is going to be miss leading! I will have to try and change it.

 

This is a limitation in my knowledge/understanding for how powerapps works and what the commands do, vs what they say!

 

It turns out, based on some research I did triggered by the replies above, that you can submit UPDATES from multiple forms as part of a patch. AND.. if you don't wrap them in curly brackets {} it is all a single entry on the list!!!

 

So my now fully functioning code reads:

If(Form1.Mode=New,Patch('Sys Inventory AW',Defaults('Sys Inventory AW'),EditForm1.Updates,Form1.Updates),Patch('Sys Inventory AW',BrowseGallery1.Selected,EditForm1.Updates,Form1.Updates));Navigate(BrowseScreen1,Fade)

 

This negates the need for me to interact with the drop down list codes and records or anything clever like that! It just applies what I have selected to the appropriate fields in my sharepoint list!

 

I feel so stupid... but I am also over the moon that I have succeeded in resolving this because it means I can progress my project to completion.. no doubt encountering another little issues along the way!

View solution in original post

10 REPLIES 10
v-micsh-msft
Community Support
Community Support

Hi @adstar22,

 

Mr-dang has a good posts regarding patch collection to SharePoint list, please check and see if it would help:

Patch a collection of items to SharePoint

For trigger the workflow, add the flow.run() behind the Patch() function.

If you need any further help on this, please post back.

Regards,

Michael

 

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

Hi,

Thanks for the reply.

I have moved on from trying to patch from collections, to trying to patch directly from forms. And I am having the same type of issue with the syntax, and identifying my record in sharepoint.

 

I check for the presence of an ID in a different context field, and this allows me to display 'form1' in new mode.

 

Currently I am trying:

 

If(Form1.Mode=New,SubmitForm(EditForm1);UpdateContext({cvID:Last('Sys Inventory AW').ID});Patch('Sys Inventory AW',First(Filter('Sys Inventory AW',ID=cvID)),{Business_x0020_Impact:BusinessImpact},{Business_x0020_Impact_x0020_Justification:BusinessImpactJustification}),Patch('Sys Inventory AW',BrowseGallery1.Selected,EditForm1.Updates,Form1.Updates));Navigate(BrowseScreen1,Fade)

 

Currently, the SubmitForm(EditForm1) works, and creates a new entry in the sharepoint list (Sys Inventory AW) based on the first entry form I display.

 

Based on all the patching instructions I have read, and because I cant use SubmitForm(Form1) (the second form I display) because it isnt "attached" to the same sharepoint record, I try and extract the new sharepoint entry ID into a context variable.

 

I think try to use the context variable to filter the sharepoint list for the matching ID, which I then patch records into... accept.. nothing seems to work from the second form!

 

It is the same as my original query... I dont appear to be able to identify the NEW sharepoint record I want to update. Solving this syntax issue would resolve all my other problems and enable me to make rapid prrogress.

 

Annoyingly... I CAN update and existing sharepoint record using the command above!!!

Have you tried to do a refresh(table) command before doing your intended update?

Hi all,

 

Yes I have refreshed the table.

 

Current code:

If(Form1.Mode=New,SubmitForm(EditForm1);Refresh('Sys Inventory AW');Patch('Sys Inventory AW',Last('Sys Inventory AW'),{Business_x0020_Impact:BusinessImpact.Selected},{Business_x0020_Impact_x0020_Justification:BusinessImpactJustification},{Compliance_x0020_Status:CompStatus.Text}),Patch('Sys Inventory AW',BrowseGallery1.Selected,EditForm1.Updates,Form1.Updates));Navigate(BrowseScreen1,Fade)

 

I thought I would try and patch something really basic: 'a single line of text' as described/defined by sharepoint. This is the highlighted command above.

 

Unlike the other fields in my patch command (business impact is a lookup field and Business Impact Justification is a multiple line of text) the Compliance Status is a single line of text.

 

What I have estabilshed now, is that i HAVE accessed the correct record in sharepoint. But my patch command is not correct due to the field types - possibly??

 

I say this because the Compliance Status field IS updated for the new record.

 

The problem now, is that it only updates the entry with the default value! If I change the entry on the powerapps form... it still applies the default value to the sharepoint list!!!

 

2 steps forwards 1 step back!

Hi @adstar22,

 

Your code:

 

If(Form1.Mode=New,
   SubmitForm(EditForm1);
     Refresh('Sys Inventory AW');
     Patch('Sys Inventory AW',
Last('Sys Inventory AW'), {Business_x0020_Impact:BusinessImpact.Selected}, {Business_x0020_Impact_x0020_Justification:BusinessImpactJustification}, {Compliance_x0020_Status:CompStatus.Text}), Patch('Sys Inventory AW', BrowseGallery1.Selected, EditForm1.Updates, Form1.Updates) ); Navigate(BrowseScreen1,Fade) )

Could you please explain a bit for the bold part?

 

For your first Patch function:

Patch('Sys Inventory AW',
Last('Sys Inventory AW'), {Business_x0020_Impact:BusinessImpact.Selected}, {Business_x0020_Impact_x0020_Justification:BusinessImpactJustification}, {Compliance_x0020_Status:CompStatus.Text}),

Do the three {} mean three different records? 

If you need to update three fields in the baseRecord (here means the Last('Sys Inventory AW')), we could write the formula in the following way:

Patch('Sys Inventory AW',
Last('Sys Inventory AW'), {Business_x0020_Impact:BusinessImpact.Selected, Business_x0020_Impact_x0020_Justification:BusinessImpactJustification, Compliance_x0020_Status:CompStatus.Text}),

 

Have you tried to replace the ComStatus.Text with the following?

Editform.LastSubmit.Compliance_x0020_Status

 

Please check and see if this would work.

Besides, for the error about type mistach, would you please share the error message here?

By using patch, there are fields that you must specify in the record, such as Title, which has been marked as unique (or the field marked with * in EditScreen ) in SharePoint list.

Regards,

Michael

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

Hi Michael,

I appreciate your time/assistance with this. Here we are all thinking that this shouldnt be as difficult as we are finding it!

I shall try and add more information as requested:

 

Because we will eventually be submitting a LOT of data to a single record on the sharepoint list, I have to split the data onto different screens, and in this example forms. To submit a "complete" new record to my sharepoint list I SubmitForm(EditForm1) which creates a new entry on the sharepoint list, with the details from the first screen.

 

The first patch function is required (I believe) because at the point I access Form1 on screen 2, in NEW mode, the record doesnt exist in sharepoint (hence the new mode). I am workign on the thoery that when the user is happy with all the data they want to enter.. they do so in one go. This should give me greater control for error handling, version control of entries, and triggering workflows.

 

You are correct about the extract {...} I miss understood the sytax and have corrected it.

 

Business_x0020_Impact is a column on my Sharepoint List. It is a lookup on the list referring to a seperate sharepoint list. The auto generated field/entry is displayed on datacard15 on form1.

BusinessImpact is the drop down list from which the user selects an item the want to "apply" /choose to the new entry. It displays the items from the same seperate Sharepoint List.

I was expecting to submit/retain the value selected in the drop down in my Sys Inventory AW list. But keep getting issues with how to patch a drop down into a drop down I think. An alternative is to make change my Sys Inventory list to a basic text field, and get powerapps to use a drop down list to populate it. But it should be possible as it is!

 

Business_x0020_Impact_x0020_Justification is a multiple lines of text field on my sharepoint list. I havent modified the default datacard which powerapps should be using to apply entries in this field to the sharepoint list. However... Not only am I not able to use the return key to create multiple lines of text... nothing is submitted to the sharepoint list!

 

The second patch function is used when editting a record using the same form(s) in Edit mode... and this all seems to work fine!

 

I have looked into and tried your final suggestion... but editform.lastsubmit didnt/doesnt work.. my guess is because the forms are in new mode, and it looks like this command is for forms in editmode?

Problem solved! At last!!!

 

This is a limitation in my knowledge/understanding for how powerapps works and what the commands do, vs what they say!

 

It turns out, based on some reasearch I did triggered by the replies above, that you can submit UPDATES from multiple forms as part of a patch. AND.. if you dont wrap them in curly brackets {} it is all a single entry on the list!!!

 

So my now fully functioning code reads:

If(Form1.Mode=New,Patch('Sys Inventory AW',Defaults('Sys Inventory AW'),EditForm1.Updates,Form1.Updates),Patch('Sys Inventory AW',BrowseGallery1.Selected,EditForm1.Updates,Form1.Updates));Navigate(BrowseScreen1,Fade)

 

This negates the need for me to interact with the drop down list codes and records or anythgin clever like that! It just applies what I have selected to the approariate fields in my sharepoint list!

 

I feel so stupid... but I am also over the moon that I have succeded in resolving this because it means I can progress my project to compleation.. no doubt encountering another of other little issues along the way!

Problem solved! At last!!! Although... I now feel that the heading for this post is going to be miss leading! I will have to try and change it.

 

This is a limitation in my knowledge/understanding for how powerapps works and what the commands do, vs what they say!

 

It turns out, based on some research I did triggered by the replies above, that you can submit UPDATES from multiple forms as part of a patch. AND.. if you don't wrap them in curly brackets {} it is all a single entry on the list!!!

 

So my now fully functioning code reads:

If(Form1.Mode=New,Patch('Sys Inventory AW',Defaults('Sys Inventory AW'),EditForm1.Updates,Form1.Updates),Patch('Sys Inventory AW',BrowseGallery1.Selected,EditForm1.Updates,Form1.Updates));Navigate(BrowseScreen1,Fade)

 

This negates the need for me to interact with the drop down list codes and records or anything clever like that! It just applies what I have selected to the appropriate fields in my sharepoint list!

 

I feel so stupid... but I am also over the moon that I have succeeded in resolving this because it means I can progress my project to completion.. no doubt encountering another little issues along the way!

Update: I did get this resolved. not sure how or if it was just a glitch in powerapps but it is working as it should.

 

hoping to resurect this post. I am in the same boat and while i can submit new when i try and update and submit i get an error

 

"Modified:The specified column is generated by the server and cant be specified"

 

I am assuming that it is referring to the modified column in the data source (sharepoint list standard column) I am not using it at all in my app so i am stumped.

 

Any ideas? has the method changed since this worked?

 

Thanks

Helpful resources

Announcements

Update! June 13th, Community Ambassador Call for User Group Leaders and Super Users

Calling all Super Users & User Group Leaders     UPDATE:  We just wrapped up June's Community Ambassador monthly calls for Super Users and User Group Leaders. We had a fantastic call with lots of engagement. We are excited to share some highlights with you!    Big THANK YOU to our special guest Thomas Verhasselt, from the Copilot Studio Product Team for sharing how to use Power Platform Templates to achieve next generation growth.     A few key takeaways: Copilot Studio Cookbook Challenge:  Week 1 results are posted, Keep up the great work!Summer of Solutions:  Starting on Monday, June 17th. Just by providing solutions in the community, you can be entered to win tickets to Power Platform Community Conference.Super User Season 2: Coming SoonAll communities moving to the new platform end of July We also honored two different community members during the call, Mohamed Amine Mahmoudi and Markus Franz! We are thankful for both leaders' contributions and engagement with their respective communities. 🎉   Be sure to mark your calendars and register for the meeting on July 11th and stay up to date on all of the changes that are coming. Check out the Super User Forum boards for details.   We're excited to connect with you and continue building a stronger community together.   See you at the call!  

Win free tickets to the Power Platform Conference | Summer of Solutions

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**

Copilot Cookbook Challenge | Week 2 Results | Win Tickets to the Power Platform Conference

We are excited to announce the "The Copilot Cookbook Community Challenge is a great way to showcase your creativity and connect with others. Plus, you could win tickets to the Power Platform Community Conference in Las Vegas in September 2024 as an amazing bonus.   Two ways to enter: 1. Copilot Studio Cookbook Gallery: https://aka.ms/CS_Copilot_Cookbook_Challenge 2. Power Apps Copilot Cookbook Gallery: https://aka.ms/PA_Copilot_Cookbook_Challenge   There will be 5 chances to qualify for the final drawing: Early Bird Entries: March 1 - June 2Week 1: June 3 - June 9Week 2: June 10 - June 16Week 3: June 17 - June 23Week 4: June 24 - June 30     At the end of each week, we will draw 5 random names from every user who has posted a qualifying Copilot Studio template, sample or demo in the Copilot Studio Cookbook or a qualifying Power Apps Copilot sample or demo in the Power Apps Copilot Cookbook. Users who are not drawn in a given week will be added to the pool for the next week. Users can qualify more than once, but no more than once per week. Four winners will be drawn at random from the total qualifying entrants. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once. If they are drawn multiple times, another user will be drawn at random. Prizes:  One Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value, does not include travel, lodging, or any other expenses) Winners are also eligible to do a 10-minute presentation of their demo or solution in a community solutions showcase at the event. To qualify for the drawing, templates, samples or demos must be related to Copilot Studio or a Copilot feature of Power Apps, Power Automate, or Power Pages, and must demonstrate or solve a complete unique and useful business or technical problem. Power Automate and Power Pagers posts should be added to the Power Apps Cookbook. Final determination of qualifying entries is at the sole discretion of Microsoft. Weekly updates and the Final random winners will be posted in the News & Announcements section in the communities on July 29th, 2024. Did you submit entries early?  Early Bird Entries March 1 - June 2:  If you posted something in the "early bird" time frame complete this form: https://aka.ms/Copilot_Challenge_EarlyBirds if you would like to be entered in the challenge.   Week 1 Results:  Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Copilot Cookbook Gallery:Power Apps Cookbook Gallery:1.  @Mathieu_Paris 1.   @SpongYe 2.  @Dhanush 2.   @Deenuji 3.  n/a3.   @Nived_Nambiar  4.  n/a4.   @ManishSolanki 5.  n/a5.    n/a   Week 2 Results:  Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Copilot Cookbook Gallery:Power Apps Cookbook Gallery:1. Kasun_Pathirana1. ManishSolanki2. cloudatica2. madlad3. n/a3. SpongYe4. n/a4. n/a5. n/a5. n/a

Celebrating the June Super User of the Month: Markus Franz

Markus Franz is a phenomenal contributor to the Power Apps Community. Super Users like Markus inspire others through their example, encouragement, and active participation.    The Why: "I do this to help others achieve what they are trying to do. As a total beginner back then without IT background I know how overwhelming things can be, so I decided to jump in and help others. I also do this to keep progressing and learning myself." Thank you, Markus Franz, for your outstanding work! Keep inspiring others and making a difference in the community! 🎉  Keep up the fantastic work! 👏👏   Markus Franz | LinkedIn  Power Apps: mmbr1606  

Your Moment to Shine: 2024 PPCC’s Got Power Awards Show

For the third year, we invite you, our talented community members, to participate in the grand 2024 Power Platform Community Conference's Got Power Awards. This event is your opportunity to showcase solutions that make a significant business impact, highlight extensive use of Power Platform products, demonstrate good governance, or tell an inspirational story. Share your success stories, inspire your peers, and show off some hidden talents.  This is your time to shine and bring your creations into the spotlight!  Make your mark, inspire others and leave a lasting impression. Sign up today for a chance to showcase your solution and win the coveted 2024 PPCC’s Got Power Award. This year we have three categories for you to participate in: Technical Solution Demo, Storytelling, and Hidden Talent.      The Technical solution demo category showcases your applications, automated workflows, copilot agentic experiences, web pages, AI capabilities, dashboards, and/or more. We want to see your most impactful Power Platform solutions!  The Storytelling category is where you can share your inspiring story, and the Hidden Talent category is where your talents (such as singing, dancing, jump roping, etc.) can shine! Submission Details:  Fill out the submission form https://aka.ms/PPCCGotPowerSignup by July 12th with details and a 2–5-minute video showcasing your Solution impact. (Please let us know you're coming to PPCC, too!)After review by a panel of Microsoft judges, the top storytellers will be invited to present a virtual demo presentation to the judges during early August. You’ll be notified soon after if you have been selected as a finalist to share your story live at PPCC’s Got Power!  The live show will feature the solution demos and storytelling talents of the top contestants, winner announcements, and the opportunity to network with your community.  It's not just a showcase for technical talent and storytelling showmanship, show it's a golden opportunity to make connections and celebrate our Community together! Let's make this a memorable event! See you there!   Mark your calendars! Date and Time: Thursday, Sept 19th Location: PPCC24 at the MGM Grand, Las Vegas, NV 

Tuesday Tip | Accepting Solutions

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   To enhance our collaborative environment, it's important to acknowledge when your question has been answered satisfactorily. Here's a quick guide on how to accept a solution to your questions: Find the Helpful Reply: Navigate to the reply that has effectively answered your question.Accept as Solution: Look for the "Accept as Solution" button or link, usually located at the bottom of the reply.Confirm Your Selection: Clicking this button may prompt you for confirmation. Go ahead and confirm that this is indeed the solution.Acknowledgment: Once accepted, the reply will be highlighted, and the original post will be marked as "Solved". This helps other community members find the same solution quickly. By marking a reply as an accepted solution, you not only thank the person who helped you but also make it easier for others with similar questions to find answers. Let's continue to support each other by recognizing helpful contributions. 

Top Solution Authors
Top Kudoed Authors
Users online (4,606)