You need to sign in to do that
Don't have an account?
subaa
DATETIME value update thru Trigger doesn't reflected in detail page
Hi,
We got a requirement to set TIME value for both Start and End date as '12:00:00', when a visit status (custom field) saved as 'Cancelled'. I inlcuded my logic inside the 'before update' trigger on Event object. I able to see the expected values in the debug log for both fields. But it is not reflected on Visit's detail page. Can anyone assist me to resolve this issue.
Regards,
SuBaa
Please share your code, will help in tracing the issue
Please see the attached source code.
if(trigger.isBefore) {
if(trigger.isUpdate){
String newYear = '';
String newMonth = '';
String newDay = '';
String newHour = '';
String newMinute = '';
String newSecond = '';
String myStartDateStr = '';
String myEndDateStr = '';
for(Event e : Trigger.new) {
// if Status was Cancelled
if(e.Visit_Status__c == 'Cancelled'){
Datetime t = e.StartDateTime;
newYear = String.valueOf(t.year());
newMonth = String.valueOf(t.month());
newDay = String.valueOf(t.day());
newHour = '17';
newMinute = '30';
newSecond = '00';
myStartDateStr = newYear + '-' + newMonth + '-' + newDay + ' ' + newHour + ':'
+ newMinute + ':' + newSecond;
Datetime myStartDate = datetime.valueOf(myStartDateStr);
e.StartDateTime = myStartDate;
myEndDateStr = newYear + '-' + newMonth + '-' + newDay + ' ' + newHour + ':'
+ newMinute + ':' + '05';
Datetime myEndDate = datetime.valueOf(myEndDateStr);
e.EndDatetime = myEndDate;
}
}
}
}
Regards,
SuBaa
Hi,
Can anyone judge my point about Event DateTime field values.
If IsAllDayEvent field set to False, then ActivityDate and ActivityDateTime field values must be either NULL or same as StartDateTime field value of that Event. According to this I copy the StartDateTime value to both ActivityDate and ActivityDateTime, but it is not working.
Please help me, to fix assign StartDateTime value for ActivityDate and ActivityDateTime.
Regards,
SuBaa
Hi,
I fixed this issue by having the same value in StartDateTime, ActivityDate and ActivityDateTime fields and also adjusted the DurationInMinutes field value as [EndDateTime - StartDateTime]
But it shows PM after the timing value (12:00 PM), rather than 12:00 AM which really we want.
Can anyone help me?
Regards,
SuBaa