Remove meeting creator from invitees


We have a problem when a meeting is created and assigned to another user different from the meeting creator. Normally we have an user that contacts a “Contact” and set up a meeting with a sales agent. The meeting creator assigns then the meeting to the Sales Rep and relates it to the “Contact”.
The problem is that the meeting creator is added by default to the meeting as invitee, and appears also in his calendar, but this is wrong.

Is there any way to get removed the meeting creator from the meetings (even in an after_save hook, if you can let me know how)?.

Thanks a lot

I don’t know, and I couldn’t find anything online.

If I were you i would try to figure out how things are happening in the database first. I see some tables there with suggestive names, meetings_contacts, reminders_invitees, …

Then once you have that you can try using the generic mechanisms in SuiteCRM Beans to navigate the relationships and get to the data you need to change.

Just to let everyone know how I got this fixed, in case you need it. What I have done is creating an “AfterSave” hook that checks if the created_by and the assigned_user_id are the same. If not what I do is run an SQL to set the values to "deleted=‘1’ " for all the records in the meetings_users table where the meeting_id is the id of the meeting we are working with and also the user_id is not the meeting->assigned_user_id.

This way I make sure that the only user that appears in the Invitees list is the one assigned, not also the creator of the record.

This reduces a lot the “spaces” not needed in the calendar of the user.

Hope it helps!

1 Like

Good. Do you want to post the complete logic hook? I think it can be useful for others… thanks!


I think I have shut the gun of success to soon :lol: !!

I have created this login hook “before save” which it is fired when I open an “existing” meeting record, but not when I “create” a new record???
Any explanation why this might be happening?

The idea is to create a meeting record and assign it to another user, but getting ourselfs to be removed from the Invitees list.

public static function UnicoUsuarioInvitado($bean, $event, $arguments)
      if ($bean->created_by!=$bean->assigned_user_id)
           global $db;
           $sql = 'UPDATE meetings_users SET deleted="1" WHERE
                  meeting_id ="'.$bean->id.'" AND user_id!="'. $bean->assigned_user_id.'";';

} End of function UnicoUsuarioInvitado

And we edited the logic_hook.php file this way

$hook_array['before_save'][] = Array(3, 'HooksMeetings', 'custom/modules/Meetings/Hooks/meetingHooks.php','MeetingHooks', 'UnicoUsuarioInvitado');

If I create a new meeting record, and assign it to another user, I am still in the meeting invitees list. If I open the record and save it with no modification, then seems that the logic_hook gets fired and I am removed from the invitees list. I have tried to use this with “after_save”, but get the same result

Any sugestions??

Thanks so much

I would start by making sure if your problem is that the hook is not firing with created records, or that it is firing but this condition is evaluating to false:

if ($bean->created_by!=$bean->assigned_user_id)


Sorry, yes we tought the same, and we removed this condition, but we got the same result, the hook it is not fired with the record is created. If we open it and save it back with not chane it works

For the moment what we have done is to create an Scheduler to be run every 2 mins to run the same script, but to tell you the truth I dont like this solution quite a lot, as it affects the cpu performance.

Any ideas??

Thanks a lot

This post here

seems to confirm that logic hooks do fire on new records (as I expected).

How exactly are you creating the new meeting, is it manually from the UI? Which bit of UI, exactly? I wonder if there could be some code going directly to the database, skipping the Beans, and thus skipping the hooks.

Hi, yes we just create the meeting from the UI and in the Edit Mode view, we change the “assigned to” from the user logged it, to another user of the system.

If we save the meeting, nothing happens, if we then reopen the meeting record for edition and save it with no change, the logic_hook gets fired


It has a similar behaviour with another situation we have. Totally diferent “business case”, but similar behaviour,. For example if we have a meeting related to an account, if we open it and change the related to from “Account” to “Contact”,if we then select the Contact, we are not able to add a meeting reminder to the contact. We need to save the meeting with the changes done, and then reopen it back to add the reminder to the contact.
I know is totally different but it is something we should be able to do (in my understanding of course) as soon as we select the meeting to be related to a picked contact, am I right?


Something is definitely escaping our comprehension here…

Can you please check your logs for any FATAL or ERROR messages:

  • suitecrm.log
  • php_errors.log


In suitecrm.log file we can find this

Fri May 18 14:12:09 2018 [6508][1][FATAL] 0

in php_errors.log there is nothing.

Raise your SuiteCRM log level to DEBUG, retry the operation, and see what is in the logs just before that FATAL error.

I’ve been looking at this myself, you need to use the ‘after_relationship_add’ Logic Hook in the Users module.