AnsweredAssumed Answered

Meetings - Creating meeting programatically wrongly taking date_start & date_end.

Question asked by Kishor Mali on Apr 3, 2019

Hello Sugar Experts,

I have a requirement where, on satisfying certain condition, I need to create a child meeting from current meeting.

I have written a custom action for workflow.

I have custom fields like followup_startdate_c & followup_enddate_c on Meetings module. The datetime I am putting in these two, is expected to be the date_start and date_end of next child meeting (which is going to create programatically).


Code Sample:

public function createChildMeeting($parentMeetingBean)
     $module = "Meetings";
     $bean = BeanFactory::newBean($module);

     $bean->name = $parentMeetingBean->name . ' - Follow Up';
     $bean->call_type_c = "Follow_up";
     $bean->status = "Planned";
     $bean->follow_up_c = 0;
     $bean->date_start = date("Y-m-d H:i:s", strtotime($parentMeetingBean->followup_startdate_c));
     $bean->date_end = date("Y-m-d H:i:s", strtotime($parentMeetingBean->followup_enddate_c));
     $bean->assigned_user_id = $parentMeetingBean->assigned_user_id;
     $bean->date_entered = date("Y-m-d H:i:s");
     $bean->date_modified = NULL;




If in my parent meeting,

followup_startdate_c = "2019-04-04 18:00";
followup_enddate_c = "2019-04-04 18:30";

Then, in child meeting it comes as,

date_start = "2019-04-04 18:00";
date_end = "2019-04-04 18:00";
(0) Minutes

date_end must be : "2019-04-04 18:30". But at the end it just same as date_start.

Is there any parameter that I am missing, which is need to set during create Meeting programatically?

Help is highly appreciated.