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

Patching a collection record property that is itself a record and saving to CDS

I have a collection (colTasks) One of the properties is es_week, which is a lookup (so a record itself). I can save this back to CDS without issue. I can modify the es_week for all colTasks with the following method and it will save to CDS without issue:

ClearCollect( 
    colTasks, 
    AddColumns( 
        ShowColumns( 
            colTasks, 
            "es_effort", 
            "es_name", 
            "es_responsibleuser" 
        ), 
        "es_week", 
        ComboBox2.Selected 
    ) 
); 


For reference, 

ComboBox2.Items = Filter(Weeks, 'Weeks (Views)'.'Next 6 Months')


However, I have a button that increments a single week up with the following OnSelect method:

Patch( 
    colTasks, 
    ThisItem, 
    { 
        es_week: First( 
            Filter( 
                Weeks, 
                'Week Number' = ThisItem.es_week.'Week Number' + 1 
            ) 
        ) 
    } 
); 


It updates colTasks as expected and other parts of the app reflect the change and behave appropriately.

Screen Shot 2019-09-12 at 6.13.03 PM.png

However, on saving to CDS, PowerApps saves all the other records but does not even attempt to save the record whose week has been changed (I watched network traffic). Instead throws the error Value must be a data entity record.

On inspection of the colTasks.es_week using view collection, it appears to be property-per-property identical to all the other records, but something somewhere doesn't like it.

Screen Shot 2019-09-12 at 6.20.25 PM.pngScreen Shot 2019-09-12 at 6.16.21 PM.pngScreen Shot 2019-09-12 at 6.16.27 PM.png

Any ideas what I'm doing wrong? Genuinely, Sam

 

 

2 REPLIES 2
Highlighted
Community Support
Community Support

Hi @iflyadesk ,

That's a little strange... After reading about your formulas seriously, I did not find anything wrong.

Based on the pics that you showed, do you mean that the updated record other data is right , except the es-weekid field?

If so, I suggest you try to change this field's value and update again.

For example:

ClearCollect(test,First( 
                         Filter( 
                         Weeks, 
                         es_week.'Week Number' = ThisItem.es_week.'Week Number' + 1 
                                ) 
                         ) ;
Patch( colTasks, ThisItem, { es_week:First(test)}
)

 

 

Best regards,

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

Awesome idea, @v-yutliu-msft !  Unfortunately, it didn't work. Smiley Sad

 

I reached out to Microsoft Customer Support through the Admin Center and they did a screenshare with me and even brought on a "senior engineer" who seems to think I've done everything correctly as well, so this might actually be a bug in the platform.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,351)