Can anyone provide me sample apex code to create recurring event in salesforce.
I am using below code:
Event newEvent = new Event();
newEvent.OwnerId = '023170000004yO9AAI';
newEvent.Subject ='Test';
newEvent.WhatId = recordId;
newEvent.IsRecurrence = true;
newEvent.RecurrenceStartDateTime = System.today();
newEvent.RecurrenceEndDateOnly = System.today()+30;
newEvent.RecurrenceType = 'RecursDaily';
newEvent.IsAllDayEvent =true;
newEvent.DurationInMinutes =1440;
newEvent.ActivityDate = yagyaPerformanceObj.Start_Date__c;
insert newEvent;
I am using above code to create recurring event. My requirement is to create recurring event for 30 days which recurs daily. I am getting this error 'REQUIRED_FIELD_MISSING, Required fields are missing: [Recurrence Interval]: [Recurrence Interval]'
I don't know which field I am missing.