@AuraEnabled
public static List<Event> getEventList(Decimal month, Decimal year) {
Integer workingMonth = (Integer)month;
Integer workingYear = (Integer)year;
system.debug('year ' + year);
system.debug('currentMonth' + workingMonth);
List<Event> eventList = [SELECT Subject, Id, StartDateTime, Department__c, Out_Of_Office__c, Status__c, Reporting_Calendar__c FROM Event
WHERE (CALENDAR_MONTH(StartDateTime) = :workingMonth AND CALENDAR_YEAR(StartDateTime) = :workingYear) AND Reporting_Calendar__c=true AND isRecurrence=false]; //
system.debug(eventList);
return eventList;
}
@AuraEnabled
public static Event getNewEvent(Event newEvent) {
String userId = UserInfo.getUserId();
newEvent.OwnerId = userId;
upsert newEvent;
system.debug(newEvent);
return newEvent;
}
Here is my current solution that seems to be working. Basically delete the specific event and make a new one with the details of the deleted one @AuraEnabled
public static Event getEditEvent(Event newEvent) {
Event oldEvent = newEvent;
delete oldEvent;
newEvent.Id = null;
newEvent.DurationInMinutes = 60;
upsert newEvent;
system.debug(newEvent);
return newEvent;
}