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 / SharePoint List Modify...
Power Apps
Unanswered

SharePoint List Modifying previous record

(0) ShareShare
ReportReport
Posted on by 87

Hi All, 

I need to update the end date in the first record based on the start date on the second record, is there any possible way to do that in a dynamic way.

thanks in advance, 

the screen is attached.

Untitled.png

Categories:
  • RusselThomas Profile Picture
    4,014 on at

    Hi @Yazeed_Ablan ,

    There are a lot of unknowns here - on the face of it you're facing a chicken and egg scenario with your first record not having a previous record, or your last record not having a next record.  Not sure if you're wanting to update the existing list once-off, or just figure out a formula to maintain the list as new data is captured.

     

    I'll have to assume for now that we're adding new records with Patch() and you want the new record's StartDate to update the last record's EndDate.  If this is not what you mean, please try and clarify.

    Otherwise you can consider something like the following when a new record is captured;

     

    Patch(mySource, Defaults(mySource), {
     StartDate: Patch(mysource, Last(mySource), {EndDate: StartDateInput}).EndDate
     }
    )

     

    StartDateInput here is wherever your input for the StartDate of the new record is coming from. 

    If it's a datepicker or something it would be the control output - eg: DatePicker.SelectedDate

    In effect, you're running two Patch() functions - the first updates the last record enddate with the startdate input, the second adds a new record with the startdate input. They're just nested like this to try and reduce inconsistencies if other people are also adding records in between these two functions - however it's still possible that Last() when the inner Patch() is run could be different to the last record when the outer Patch() is run, depending on how often and how fast people are updating this list.

    Hope this helps,

    RT

  • Yazeed_Ablan Profile Picture
    87 on at

    Hi @RusselThomas , 

    Im building a works and i need an activity log, 

    the problem that im facing that i need to have the start date of the second step "technical team leader approval" 

    and put that date in the end date of the first step "Pending project manager" . 

    thank you in advance.

  • RusselThomas Profile Picture
    4,014 on at

    Hi @Yazeed_Ablan ,

    I see a lot of entries that don't seem to follow an obvious pattern or show how activities might be linked.

    For example, "technical team leader approval" doesn't always immediately follow "pending project manager" or always have a corresponding "pending project manager" in your list.  Sometimes there are two "technical team leader approval" entries with no corresponding "pending project manager" entries - assuming they come in pairs.

     

    If you mean, whenever "technical team leader approval" is added it must update the previous or corresponding "pending project manager" entry in the list, then how can you tell which "pending project manager" entry you want to update?  The answer to that question might inform us as to what your inner Patch() formula in my previous response would look like.

    Kind regards,

    RT

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 226 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 191 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 167

Last 30 days Overall leaderboard