You need to sign in to do that
Don't have an account?
CasselJ
Duration and EndDateTime must match.: [DurationInMinutes]
CAN anyone show me the formulat to correctly calculate this field as it does Not auto update when I change the endDatetime field.
datetime dt = datetime.parse(strDT);
e.startDateTime =dt;
if(e.endDateTime < dt){
dt = dt.addHours(1);
e.endDateTime = dt;
endDate = dt.format('yyyy-MM-dd', 'America/New_York');
endTime = dt.format('HH:mm', 'America/New_York');
strEndDatetime = endDate + 'T' + endTime;
system.debug('#####################################New End Date' + e.endDateTime);
}else{
//thisis to insure updating of the duration field
e.endDateTime = e.endDateTime.addMinutes(15);
e.endDateTime = e.endDateTime.addMinutes(-15);
}
datetime dt = datetime.parse(strDT);
e.startDateTime =dt;
if(e.endDateTime < dt){
dt = dt.addHours(1);
e.endDateTime = dt;
endDate = dt.format('yyyy-MM-dd', 'America/New_York');
endTime = dt.format('HH:mm', 'America/New_York');
strEndDatetime = endDate + 'T' + endTime;
system.debug('#####################################New End Date' + e.endDateTime);
}else{
//thisis to insure updating of the duration field
e.endDateTime = e.endDateTime.addMinutes(15);
e.endDateTime = e.endDateTime.addMinutes(-15);
}
Is the issue happening Salesforce Mobile ? If so, there is currently a known issue that the product team is working to fix. Please see https://trailblazer.salesforce.com/issues_view?id=a1p3A000001HlhWQAS for more details. If it is not a mobile issue, please give more background so I can advise?
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Hi Swetha, Thank you for your input. No this is happening in classic. I find it now impoosible to create or edit any event where the datetime fields are changed.
How is this field determined?
Ok I have tried this: It seems to be working in the sandbox;
if i change the start date i must add a second to teh enddate to trigger the recalculation of the durationinminutes;
Also: BIG Important thing here: It seems this will ony recalculate if the duration in minutes is null; so if i set it to null and then change the datatime fields it works.
It has to be set to null prior to each change.
datetime dt = datetime.parse(strDT);
e.endDateTime = dateTime.valueOf(dt);
This might have something to do with offsets