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 Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,401)