cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Steve10001
Frequent Visitor

Writing a collection back to a table in Dataverse using PowerApps for Teams

I was wondering if somebody could help me resolve the mystery that I’m struggling with please?

 

I’m looking to create a new set of records for a new reporting month. I need to keep the history for reporting.

 

I’m trying to append some records to an existing table within Dataverse for Teams after being amended.  I’m doing this in 3 stages

 

  1. Taking the relevant record into a collection using ClearCollect from the original table;
  2. Amending the reporting month using the Update function;
  3. Append the new records to the original table.

 

CopyRisks is the collection I'm using to collect the current months data (9 records), change the month.  Risks is the dataverse table that I want to append with the amended data.  

 

I have the first two actions working well but the third is alluding me!

 

I tried several approaches but with no success.  The two main ones are listed below. 

 

 

Using ForAll / Patch function

 

 

ForAll(CopyRisks, 
    Patch(Risks,Defaults(Risks),ThisRecord));

 

 

 

This works in PowerApps for Office365 but not in PowerApps for Teams, though it PowerApps for Teams doesn’t seem to like the table (though it recognises it!)

 

I have got patch to write back to the table.  Perhaps it the ForAll statement?

 

Using Collect, writing back the whole collection

 

 

Collect(Risks,CopyRisks)

 

 

There no errors showing in this formula but nothing happening.  Could it be that there are some lookup and choice columns in the original table.  I thought that patching the whole collection may resolve this. 

 

The table is long (with 100 plus columns) but that the nature of the requirement and I’d trying to keep the solution as simple as possible! There will only be ‘tens’ of rows and Performance otherwise is not bad.

 

I’ve gone through various loops on this and fast running out of ideas!

3 REPLIES 3
BCLS776
Super User
Super User

Part of the problem may be coming from how Power Apps for Teams is configured -- the Team gets its own special environment. As a result, your Risks table may not be the one you think it is. Check the data connections in your app carefully to see which environments you are accessing. See this blog and this doc for more details on how to make sure you are accessing the table in the correct environment.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
Steve10001
Frequent Visitor

Thank you!  I check that out and let you know what I find.

Steve10001
Frequent Visitor

I don't seem to get the options of changing the environment. I might just have a chat with our administrators.  I'm using the tables elsewhere successful so I suspect it more formula based than infrastructure but thanks for the suggestion!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,874)