web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching to 2 separate...
Power Apps
Answered

Patching to 2 separate sharepoint list from 2 collections on select of button

(0) ShareShare
ReportReport
Posted on by 125

Hello,

 

I am having a bit of an issue with an app I am building.

 

The way the app works is thus.

 

A user will create an idea and submit it to a sharepoint list, using the app.

The app will allow someone to go in and schedule that idea to be reviewed at a meeting. 

The app will populate the agenda of the meeting and allow the idea to be updated and actions to be raised against that item, the actions are stored in a sharepoint list. These are then reviewed at the end of the meeting and then the updates get pushed back to the 2 separate sharepoint lists.

 

To assist with this I have set up a collection for Idea updates (colMeetingoutput) and a collection for the actions(colDTActions), with the actions capturing the ID of the Idea so they can be related to each other.

 

The issue I have is that in trying to patch the updates back to the sharepoint lists the below formula seems to be failing, although I get no error messages and from a formula perspective everything seems fine. The formula is against an On Select action of a button.

 

ForAll(
 colDTActions,
 Patch(
 'Digital Triage Action tracker',
 Defaults('Digital Triage Action tracker'),
 {
 Action: Action,
 'Assigned to': Assignedto,
 'Idea ID': IdeaID
 }
 )
);
ForAll(
 colMeetingOutput,
 Patch('Ideas PoC',
 LookUp('Ideas PoC',ID=colMeetingOutput.ID),
 {
 'Assigned to': {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpanderUser",
Claims:" ",
Department:" ",
DisplayName: Assignedto,
Email: " ",
JobTitle:" ",
Picture:" "},
 'Digital Triage Comments': DigitalTriageComments,
 'Digital Triage Outcome': {Value:DigitalTriageOutcome},
 Priority: {Value:Priority},
 'Date For Review Technical Efficiency':DateForReviewTechnicalEfficiency,
 Status:{Value:Status},
 Title:Title
 }
 )
);
Clear(colMeetingOutput);
Clear(colDTActions)

 

I had this working with the first ForAll, but as soon as I added the 2nd one it stopped working (my assumption being that I cant do 2 ForAll actions). However not even the first For All action is working now.

 

Is anyone able to help me with this particular dilemma, please?

Categories:
I have the same question (0)
  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Maybe not a way to fix it but to see if it is working add in:

    ForAll(
     colDTActions,
     If(
     IsEmpty(
     Errors(
     'Digital Triage Action tracker',
     Patch(
     'Digital Triage Action tracker',
     Defaults('Digital Triage Action tracker'),
     {
     Action: Action,
     'Assigned to': Assignedto,
     'Idea ID': IdeaID
     }
     )
     )
     ),
     Clear(colMeetingOutput);
     Notify("Information has been saved",NotificationType.Success),
     Notify("Information has not been saved",NotificationType.Error)
     )
    );
    ForAll(
     colMeetingOutput,
     If(
     IsEmpty(
     Errors(
     'Ideas PoC',
     Patch(
     'Ideas PoC',
     LookUp('Ideas PoC',ID=colMeetingOutput.ID),
     {
     'Assigned to': 
     {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpanderUser",
     Claims:" ",
     Department:" ",
     DisplayName: Assignedto,
     Email: " ",
     JobTitle:" ",
     Picture:" "},
     'Digital Triage Comments': DigitalTriageComments,
     'Digital Triage Outcome': {Value:DigitalTriageOutcome},
     Priority: {Value:Priority},
     'Date For Review Technical Efficiency':DateForReviewTechnicalEfficiency,
     Status:{Value:Status},
     Title:Title
     }
     )
     )
     ),
     Clear(colDTActions);
     Notify("Information has been saved",NotificationType.Success),
     Notify("Information has not been saved",NotificationType.Error)
     )
    )

     

  • Jezter12 Profile Picture
    125 on at

    Right so I have now managed to find an error message and it looks like I can isolate the issue down to one part of the formula

    ForAll(
     colMeetingOutput,
     Patch('Ideas PoC',
     LookUp('Ideas PoC',ID=colMeetingOutput.ID)

    I get an issue on the ID=

    It tells me that they are incompatible types for comparison number table.

     

    So I guess the question is how do I change my formula to resolve that? 

    Google, so far, has been a little unhelpful.

     

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Instead of LookUp you could use a Filter. If ThisRecord or ThisItem doesn't work there could be a 

    colMeetingOutput.ID.Value

     

    First(
     Filter(
     'Ideas PoC', 
     ID = ThisRecord.ID
     )
    )

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Concat

  • Verified answer
    Jezter12 Profile Picture
    125 on at

    Thanks for the responses, not sure what I want to Concat though 🙂

     

    However I have now fixed it. The problem was 2 things.

     

    So the first one i resolved thanks to this post

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Patch-a-Collection-with-LookUp-to-update-existing-records/td-p/826552

    This allowed me to do the lookup against ID.

     

    However i then hit a problem with my Assigned to field in that it couldnt find the Displayname. This then had me looking at how i was capturing data in my collection, and I saw that I was just capturing the displayname in it. I changed this and the whole thing then began working.

     

    My formula now looks thus

     

    ForAll(
     colDTActions,
     Patch(
     'Digital Triage Action tracker',
     Defaults('Digital Triage Action tracker'),
     {
     Action: Action,
     'Assigned to': Assignedto,
     'Idea ID': IdeaID
     }
     )
    );
    ForAll(
     colMeetingOutput As _update,
     Patch('Ideas PoC',
     Coalesce(LookUp('Ideas PoC',ID=_update.ID)),
     {
     'Assigned to': _update.Assignedto,
     'Digital Triage Comments': _update.DigitalTriageComments,
     'Digital Triage Outcome': {Value:_update.DigitalTriageOutcome},
     Priority: {Value:_update.Priority},
     'Date For Review Technical Efficiency':_update.DateForReviewTechnicalEfficiency,
     Status:{Value:_update.Status},
     Title:_update.Title
     }
     )
    );
    Clear(colMeetingOutput);
    Clear(colDTActions)

     

    Thank you again, as even though i didnt get the direct answer. I was set upon a path that revealed the answer to me. And that is far more rewarding 🙂

  • Jezter12 Profile Picture
    125 on at

    I'm going to add those success failure messages onto my formula, as i think that also gives a better user experience. So thank you.

  • KRider Profile Picture
    577 Super User 2024 Season 1 on at

    Awesome! Love that I could help out.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    noice noice and with concat you can make the table to a string and then you can do whatever

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 610

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard