cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

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**   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. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     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. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,838)