cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
iflyadesk
Level: Powered On

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
Community Support Team
Community Support Team

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

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.
iflyadesk
Level: Powered On

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

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 306 members 5,653 guests
Please welcome our newest community members: