cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
daruom
Helper I
Helper I

"Patch" problem with lookup fields

Hello,

I still can't use the "Patch" function on my sharepoint list, due to the lookup columns.

The table in which I want to insert data is called "Question".
There are 3 mandatory fields:
"Audit" search type field
"Question" search type field
"Response" field type true or false

 

To preview the result, I inserted a line manually and I observed the result in a collection

QuestionListQuestionListQuestionColQuestionColAuditFieldAuditFieldReponseFieldReponseField

 

So I tried this:

 

 

 

Patch(
    ReponseCol;
    Defaults(ReponseCol);
    {
        Audit: {
            ID: CurrentAuditCol.ID;
            Value: CurrentAuditCol.NumeroRapport
        };
        Question: {
            ID: ThisItem.ID;
            Value: ThisItem.ID
        };
        Reponse: true
    }
)

 

 

 

I have the following errors:
"invalid argument type. expected record value but with a different schema"
"Missing column, your formula does not have an 'Id' column with a type number"

 

This is not the first time that I have this problem.
If anyone can explain the correct route to me.
Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
daruom
Helper I
Helper I

I found the solution.
I wrote "ID" instead of "Id".

In addition, "CurrentAuditCol" being a collection, you had to use the First function.

 

Patch(
    ReponseCol;
    Defaults(ReponseCol);
    {
        Audit: {
            Id: First(CurrentAuditCol).ID;
            Value: First(CurrentAuditCol).NumeroRapport
        };
        Question: {
            Id: ThisItem.ID;
            Value: ThisItem.ID
        };
        Reponse: true
    }
)

View solution in original post

3 REPLIES 3
navso
Regular Visitor

Hi @daruom ,

 

I haven't tried sharepoint list but I think this works the same with dataverse source. Try to pass the record/id for Audit and Question fields.

 

Patch(
    ReponseCol;
    Defaults(ReponseCol);
    {
        Audit: LookUp(CurrentAuditCols, ID = CurrentAuditCol.ID),
        Question: LookUp(Questions, ID = ThisItem.ID),
        Reponse: true
    }
)

 

 

Hello,

I have tried, and I still have the same errors with this formulas.

daruom
Helper I
Helper I

I found the solution.
I wrote "ID" instead of "Id".

In addition, "CurrentAuditCol" being a collection, you had to use the First function.

 

Patch(
    ReponseCol;
    Defaults(ReponseCol);
    {
        Audit: {
            Id: First(CurrentAuditCol).ID;
            Value: First(CurrentAuditCol).NumeroRapport
        };
        Question: {
            Id: ThisItem.ID;
            Value: ThisItem.ID
        };
        Reponse: true
    }
)

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Users online (2,068)