You need to sign in to do that
Don't have an account?
Bob 11
Update Apex class to add 60 days to slotStartDay > Date.today()
I was wondering if I can update this segment of code to look at a formula field that uses date & time thats adds at least 60 days or how i can update this piece of code like if(slotStartDay > Date.today() +60? I tried addDays(60) and Date.today() +60 and when i tried to search for avialable appointment slots nothing was displayed
List<AppointmentBookingSlot> slotList = new List<AppointmentBookingSlot>(); for(FSL.AppointmentBookingSlot slot : slots){ DateTime slotStartDT = slot.interval.start; DateTime slotFinishDT = slot.interval.finish; Date slotStartDay = slotStartDT.date(); if(slotStartDay > Date.today() ){ AppointmentBookingSlot newSlot = new AppointmentBookingSlot(); Interval times = new Interval(); times.startDT = slot.interval.start; times.endDT = slot.interval.finish; newSlot.grade = slot.grade; newSlot.times = times; slotList.add(newSlot); } } System.debug('slotList:: '+ slotList); //return setToTimeZone(slotList); return slotList; } public static DateTime utcToUserTimezone(DateTime utcDT){ DateTime userDT = utcDT; String utcDtString = utcDT.format('yyyy-MM-dd HH:mm:ss', 'UTC'); //String utcDtString = utcDT.format('yyyy-MM-dd hh:mm a', 'UTC'); System.debug('@@@@ str: '+utcDtString); userDT = DateTime.valueOf(utcDtString); System.debug('@@@@ DT: '+userDT); return userDT; }
Instead of date.today() you can use system.today() in the if condition.
Modify your if condition like below.
If this helps, Please mark it as best answer.
Thanks!!
Thank you for helping. I did add that if(slotStartDay > (system.today()+60) ) but it do what i wanted it to do. I got a service appointment apex class & custom lightning component that I'm trying to change to allow users to book appointments out 60-90 days. I'm not sure you can help, but i posted the rest of the code below just in case.
Lightning Component
Helper Class
Apex Class