Ask Search:
Pravin SonawanePravin Sonawane 

While Updating Event from Custom VF page getting Error as Duration: Duration and EndDateTime must match

I have created separate Standard VF Page with extensions for Event Object and shown EventStartDateTime and EvenEndDateTime inputfield on page. I need to update event object using those fields. But I'm getting:

Error as Update failed. First exception on row 0 with id 00U1100000347ZNEAY; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Duration and EndDateTime must match.: [DurationInMinutes].

Please let me know if anyone encountered same situation and have any suggestion to overcome on this.
Sunil SarillaSunil Sarilla
Please post this question in one of the developer forums for a quick response, this forum is more focussed towards the declarative side of things.
https://developer.salesforce.com/forums/#!/feedtype=RECENT&criteria=ALLQUESTIONS
http://salesforce.stackexchange.com/
Pritam ShekhawatPritam Shekhawat
+1Sunil,  Here Duration and enddatetime field calculate duration in minutes .So how you are updating this fields?
this is the time in minutes between the datatime StartDatetime and the datatime EndDateTime.
Event event = CTestMethode.Creation_Event();
datetime datestart = Datetime.newInstance(2015, 20 , 12, 00, 00, 00);
datetime dateend = Datetime.newInstance(2015, 20 , 12, 01, 00, 00);
event.EndDateTime = datetend;
event.StartDateTime = datestart ; 
event.ActivityDateTime = datestart ; 
event.DurationInMinutes = 60;

Please post this question in one of the developer forums for a quick response, this forum is more focussed towards the declarative side of things.https://developer.salesforce.com/forums
Thanks