cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous_Hippo
Super User
Super User

How to Patch current item while using ForAll

Dears,

 

I have a collection with 2 columns. It looks something like this

Anonymous_Hippo_0-1651727658216.png

How can i patch each of this Assessment Type as a new Item in a sharepoint list. I am trying to use the following code but i am getting this error: the type of this argument 'Assessment' does not match the expected type record found type text

 

Set(
    ContainerVisible,
    false
);
ForAll(
    Collection2.AssessmentType2,
    Patch(
        'Assessment Tracker',
        Defaults('Assessment Tracker'),
        {Assessment: ThisRecord.AssessmentType2}
    )
)

 

 

Please note that in my sharepoint column "Assessment" column is a choice column which allows custom inputs

 

Thanks !! 

1 ACCEPTED SOLUTION

Accepted Solutions
Adrian_Celis
Super User
Super User

Hi @Anonymous_Hippo 

 

Try this one:

ForAll(
    Collection2,
    Patch(
        'Assessment Tracker',
        Defaults('Assessment Tracker'),
        {Assessment: 
        {
            '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
             Value: AssessmentType2
        }
        }
    )
)

View solution in original post

2 REPLIES 2
Adrian_Celis
Super User
Super User

Hi @Anonymous_Hippo 

 

Try this one:

ForAll(
    Collection2,
    Patch(
        'Assessment Tracker',
        Defaults('Assessment Tracker'),
        {Assessment: 
        {
            '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
             Value: AssessmentType2
        }
        }
    )
)
Anonymous_Hippo
Super User
Super User

@Adrian_Celis  thank you ! i did not know about this. For anyone who needs more information on what exactly this is please refer this link

http://powerappsguide.com/blog/post/sharepoint-applying-patch-to-the-6-complex-data-types

 

cheers !!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,858)