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
Community Champion
Community Champion

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.

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,789)