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 / Collect if New Record ...
Power Apps
Answered

Collect if New Record and patch if already exist in Sharepoint

(0) ShareShare
ReportReport
Posted on by 504

Hey guys, I have a gallery where I collect all data in bulk but if the record from the gallery already exists in the Sharepoint it will just update.

 

 ForAll(DateRange, Collect(Whereabouts, Defaults(Whereabouts), 
 { 
 Name: User().FullName,
 Email: Lower(User().Email),
 Date: Date,
 Morning: Morning,
 Afternoon: Afternoon
 
 }))

The code above just collect but does not update existing sharepoint list

I think I should have a lookup like this below that if any record from my gallery exist in the sharepoint list it will just update otherwise collect.

Lookup(Whereabouts, Email =User().Email && Date = Gallery1.AllItems.Date)

 

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @nagestiada :

    You could try:

     ForAll(
     DateRange, 
     If(
     IsBlank(Lookup(Whereabouts, Email =User().Email && Date in Gallery1.AllItems.Date)),
     Collect(
     Whereabouts, 
     Defaults(Whereabouts), 
     { 
     Name: User().FullName,
     Email: Lower(User().Email),
     Date: Date,
     Morning: Morning,
     Afternoon: Afternoon 
     }
     ),
     Patch(
     Whereabouts, 
     Lookup(Whereabouts, Email =User().Email && Date in Gallery1.AllItems.Date),
     { 
     Email: Lower(User().Email),
     Date: Date,
     Morning: Morning,
     Afternoon: Afternoon
     }
     )
     )
    )

    Best Regards,

    Bof

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard