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 / Changing Sharepoint li...
Power Apps
Answered

Changing Sharepoint list data based on date

(0) ShareShare
ReportReport
Posted on by 290

Hello!

 

I have this sharepoint list: 

asd.pngI am saving data by a button (It is not important for my question, just want to cover everything):

Switch(
 typDovolene,
 "Vacation",
 Collect(
 VacationTracker,
 {
 Title: User().Email,
 StartDate: StartDate.SelectedDate,
 EndDate: EndDate.SelectedDate,
 LenghtInDays: Value(lblDaysOfVacation.Text),
 TypeOfVacation: Text(typDovolene),
 DepartmentCopy: Text(
 LookUp(
 Employees,
 NameOfEmployee = User().Email
 ).Department
 )
 } 
 ),
 "Overtime",
 Collect(
 VacationTracker,
 {
 Title: User().Email,
 StartDate: StartDate.SelectedDate,
 TypeOfVacation: Text(typDovolene),
 HoursOvertime: drpOvertime.SelectedText.Value,
 DepartmentCopy: Text(
 LookUp(
 Employees,
 NameOfEmployee = User().Email
 ).Department
 )
 }
 ),
 "Business Trip",
 Collect(
 VacationTracker,
 {
 Title: User().Email,
 StartDate: StartDate.SelectedDate,
 EndDate: EndDate.SelectedDate,
 LenghtInDays: Value(lblDaysOfVacation.Text),
 TypeOfVacation: Text(typDovolene),
 DepartmentCopy: Text(
 LookUp(
 Employees,
 NameOfEmployee = User().Email
 ).Department
 )
 }
 ),
 "Halfday",
 Collect(
 VacationTracker,
 {
 Title: User().Email,
 StartDate: StartDate.SelectedDate,
 TypeOfVacation: Text(typDovolene),
 HalfdayType: drpHalfday.SelectedText.Value,
 DepartmentCopy: Text(
 LookUp(
 Employees,
 NameOfEmployee = User().Email
 ).Department
 )
 }
 )
);
Set(
 daysRequested,
 RoundDown(
 DateDiff(
 StartDate.SelectedDate,
 EndDate.SelectedDate,
 Days
 ) / 7,
 0
 ) * 5 + Mod(
 5 + Weekday(EndDate.SelectedDate) - Weekday(StartDate.SelectedDate),
 5
 ) + 1
);

If(typDovolene = "Vacation", Patch(Employees, LookUp(
 Employees,
 NameOfEmployee = User().Email
 ), {VacationValue: Value(lblAvaliableDays.Text)}));

Navigate(
 Main,
 Fade
);

There is a column called EndDate and StartDate and the input is from two Date pickers. 

 

I need a code, which will switch a whole row to another sharepoint list called VacationTrackerDone everytime when Today() > EndDate and delete this row from the VacationTracker. Basically just move it from one sharepoint list to another.

I probably know, how to write the code, but I have no idea where to type it.

 

Could someone help?

Categories:
  • Verified answer
    rubin_boer Profile Picture
    4,843 Super User 2024 Season 1 on at

    hi @Filistyn, will you consider power automate for this on a scheduled flow. this way you do not have to do anything (we are lazy). flow can check daily if the condition is true for the list (Endate < Today()) and move those items?

     

    Consider this template: Move items from one SharePoint list to another | Microsoft Power Automate and change the start to a scheduled flow.

     

    Hope this helps

  • Filistyn Profile Picture
    290 on at

    Hey! Gonna check it out and come back with results

  • Verified answer
    Filistyn Profile Picture
    290 on at

    Hey, It really worked! Thank you very much

    hgfhf.png

     

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 394 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

Last 30 days Overall leaderboard