Meeting Bean "SAVE & SEND INVITES" using code/logic_hook

Hi

I am stuck in a situation,
When I create a lead I want to create a meeting automatically and also want to sent email invites to lead_email and assigned_user.
I am creating Meeting in Leads module after_save logic hook, meting creating successfully but invites not sent.

require_once('modules/Meetings/Meeting.php');
$Meeting = new Meeting();
$Meeting->name = 'Introduction Call';
$Meeting->status = 'Planned';
$Meeting->parent_type = 'Leads';
$Meeting->parent_id = $bean->id;
$Meeting->date_start = $bean->intro_call_time_c;
$Meeting->duration = 1800;
$Meeting->description = 'test';
$Meeting->lead_invitees = $bean->id.',';  //this is the lead id, lead have email
$Meeting->send_invites = true;
$Meeting->save();

when I opened this created meeting and press button on the meeting module “SAVE & SEND INVITES” then Invite email sent, but not through code.

Try with true as a parameter:

$Meeting->save(true);

Already tried, but no luck.

:thinking:

Try following the code from here:

–> https://github.com/salesagility/SuiteCRM/blob/master/modules/Meetings/Meeting.php#L181

There are several conditions for the sending of the notifications, one of them must be your problem.

If necessary, keep tracking it when it call into the parent class here:
–> https://github.com/salesagility/SuiteCRM/blob/master/data/SugarBean.php#L2307

Eventually it should call the _sendNotifications method.

@mohsanazad
You didn’t add anybody users, contacts or leads.
The function work only for field “assigned_user_name”.

$Meeting->save(true);

Do the following:

  • Update tables “meetings_users” or “meetings_contacts” or “meetings_leads” manually. For exmple look at modules/Meetings/MeetingFormBase.php
  • Look at the function “get_notification_recipients” in modules/Meetings/Meeting.php and add arrays for notifications.

“Meetings” and “Calls” objects have a lot of specific code.