Menu
SuiteCRM dedicated support by SalesAgility
Welcome, Guest
Username: Password: Remember me

TOPIC: Remove meeting creator from invitees

Remove meeting creator from invitees 7 months 3 weeks ago #60739

  • jlabuelo
  • jlabuelo's Avatar
  • Offline
  • Senior Member
  • Posts: 53
  • Thank you received: 1
  • Karma: 0
Hello

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
The administrator has disabled public write access.

Remove meeting creator from invitees 7 months 3 weeks ago #60861

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 7883
  • Thank you received: 1221
  • Karma: 286
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.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Remove meeting creator from invitees 5 months 1 week ago #65836

  • jlabuelo
  • jlabuelo's Avatar
  • Offline
  • Senior Member
  • Posts: 53
  • Thank you received: 1
  • Karma: 0
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!
The administrator has disabled public write access.
The following user(s) said Thank You: pgr

Remove meeting creator from invitees 5 months 1 week ago #65862

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 7883
  • Thank you received: 1221
  • Karma: 286
Good. Do you want to post the complete logic hook? I think it can be useful for others... thanks!

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Remove meeting creator from invitees 5 months 1 week ago #65901

  • jlabuelo
  • jlabuelo's Avatar
  • Offline
  • Senior Member
  • Posts: 53
  • Thank you received: 1
  • Karma: 0
Hello

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.'";';
           $db->query($sql);
      }

} 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
The administrator has disabled public write access.

Remove meeting creator from invitees 5 months 1 week ago #65928

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 7883
  • Thank you received: 1221
  • Karma: 286
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)

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Remove meeting creator from invitees 5 months 1 week ago #65947

  • jlabuelo
  • jlabuelo's Avatar
  • Offline
  • Senior Member
  • Posts: 53
  • Thank you received: 1
  • Karma: 0
Hello

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
The administrator has disabled public write access.

Remove meeting creator from invitees 5 months 1 week ago #65949

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 7883
  • Thank you received: 1221
  • Karma: 286
This post here
suitecrm.com/suitecrm/forum/suitecrm-7-0...-only-on-new-records

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.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
Last Edit: 5 months 1 week ago by pgr.
The administrator has disabled public write access.

Remove meeting creator from invitees 5 months 6 days ago #66030

  • jlabuelo
  • jlabuelo's Avatar
  • Offline
  • Senior Member
  • Posts: 53
  • Thank you received: 1
  • Karma: 0
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

Wierd

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?

Regards
The administrator has disabled public write access.

Remove meeting creator from invitees 5 months 6 days ago #66040

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 7883
  • Thank you received: 1221
  • Karma: 286
Something is definitely escaping our comprehension here...

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

- suitecrm.log
- php_errors.log

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Remove meeting creator from invitees 5 months 4 days ago #66147

  • jlabuelo
  • jlabuelo's Avatar
  • Offline
  • Senior Member
  • Posts: 53
  • Thank you received: 1
  • Karma: 0
Hi,

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.
The administrator has disabled public write access.

Remove meeting creator from invitees 5 months 4 days ago #66157

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 7883
  • Thank you received: 1221
  • Karma: 286
Raise your SuiteCRM log level to DEBUG, retry the operation, and see what is in the logs just before that FATAL error.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.
Time to create page: 0.073 seconds
Powered by Kunena Forum