HOWTO: Restore automatically inviting the organizer to calls and meetings

bsoremsugar —  December 13, 2010 — 17 Comments

Sugar 6.1 just hit the streets a few weeks ago, and one of the more consistently heard critical comments is a change we made to not automatically invite people who organizers for calls and meetings ( meaning those who create the call or meeting ). This is a handy feature if you are a secretary or assistance and often schedule calls and meetings for other, so you would no longer need to remove yourself after the meeting is created or altered. But for everyone else it now requires the organizer to make sure they manually added themselves to each call or meeting they create if they wish to be invited. Fortunately, as pointed out on the forums, there’s an easy fix you can make via a logic hook to re-enable the old functionality that is perfectly upgrade safe. Let’s take a look.

To begin with, we will create the actual code that will encompass out logic hook. Since it will be shared by both the Calls and Meetings modules, we’ll put it at the top of the custom/ directory, and name it LogicHookAutoInvite.php.

set_accept_status($current_user, 'accept');
    }
}

The LogicHookAutoInvite::inviteCurrentUser() method does the simple task of invoking the set_accept_status() method for the current system user, setting it to ‘accept’ automatically. Now, so that our logic hook is executed, we’ll add definitions like the following in the custom/modules/Calls/ and custom/modules/Meetings/ directories, in the logic_hooks.php file.

<?php
$hook_version = 1;
$hook_array = Array();
$hook_array['after_save'] = Array();
$hook_array['after_save'][] = Array(1, 'Auto invite user', 'custom/LogicHookAutoInvite.php','LogicHookAutoInvite','inviteCurrentUser');

Now, every time a Call or Meeting is saved the current system user with be auto-invited to the meeting, just as we did before Sugar 6.1.

17 responses to HOWTO: Restore automatically inviting the organizer to calls and meetings

  1. 

    Will this code changes survive after release upgrade? Or I’ll have to rewrite it again?

  2. 

    Yes, this is upgrade-safe

  3. 

    Very clear instructions – thank you

    Unfortunately, I have neither a Calls nor a Meetings directory in my Custom/Modules directory. I do have the following directories in the Custom/Modules directory:
    Accounts
    Cases
    Connectors
    Contacts
    Leads
    Opportunities
    Prospects
    Tasks

    I have SugarCRM CE 6.1 – is this solution only available to paid versions (Pro and Enterprise)? Please tell me that is not so …

    To get this to work in the CE version, can I manually add Calls and Meetings directories and the logic_hooks.php file with the above code in each?

  4. 

    @ Ricjard Cantin

    Yes you can manually add those folders and get the code working for you. It is not paid at all. It is open for all the flavours of SugarCRM.

  5. 

    Hello everyone,

    Thanks for the tips, but i think i am missing something. I did the above, and quick repaired and rebuiled. When i create a new meeting, i get this: Fatal error: Class ‘LogicHookAutoInvite’ not found in *************includeutilsLogicHook.php on line 136.
    Thansks in advance!

  6. 

    Tanks, works ok

  7. 

    Working perfect in Sugar 6.1 Pro. Thank’s a lot!

  8. 

    Not sure why this changed at all, but thanks!

  9. 

    We have a telemarketing team that schedules meetings for sales reps. When a telemarketer schedules a meeting with a customer on behalf of the sales rep, that meeting needs to be auto accepted by the sales rep so that other telemarketers can see that sales reps free busy and will not double book the sales rep.

    I’m researching how to pull a list of invitees for the meeting and set_accept_status on these. Can anyone add some insight?

  10. 

    This is really helpful, thankyou!

    If the assigned user is changed after the meeting has already been created, is it possible to get the new assigned user to be auto invited upon save?

  11. 

    This adds an invite for any current user who creates or edits a call or meeting… not quite the prior behavior.  What was more helpful for us was ensuring that the Assigned To user was always an invitee.  To do that, I did the following instead:

    in custom/modules/Meetings/MeetingAutoInvite.php:
    retrieve($bean->assigned_user_id);
            $bean->set_accept_status($AssignedUser, ‘accept’);
        }
    }
    ?>
    Then in custom/modules/Meetings/logic_hooks.php add:
    $hook_array['after_save'] = Array();
    $hook_array['after_save'][] = Array(1, ‘Auto invite user’, ‘custom/modules/Meetings/MeetingAutoInvite.php’,’LogicHookAutoInvite’,’inviteAssignedUser’);
    ?>

    Do the same thing for calls if you need to.

    • 

      I had a similar problem, calling $newMeeting -> set_accept_status($bean -> assigned_user_id, ‘accept’); didn’t add a user to the meeting. The following worked for me and adds any user (in my case as Admin I was scheduling meetings for various users).

      $relate_values = array(‘user_id’ => $bean -> assigned_user_id, ‘meeting_id’ => $meetingID);$data_values = array(‘accept_status’ => “accept”);$bean -> set_relationship(“meetings_users”, $relate_values, true, true, $data_values);

      Andy

  12. 

    I’m not sure I understand this blog post because in the 6.2.4 version the organizer (user who created the call) is automatically added as an invitee. He is added as an invitee even if he is not the one that the call is assigned to. We need to click “remove” all the time when we create a call for somebody else.

  13. 

    You are soo right. I find out about this all the time.

    Incredible post.

Trackbacks and Pingbacks:

  1. New call assigned to 2 users when assigning to another users - SugarCRM Forums - September 30, 2011

    [...] [...]

  2. SugarCRM Developer Blog » Blog Archive » HOWTO: Restore automatically inviting the organizer to calls and meetings in Sugar 6.3 and later - April 12, 2012

    [...] might remember a while back we added a blog post to detail how to restore the functionality of having organizers being automatically added …. While the example worked great back in the 6.1 and 6.2 days, it’s not quite as effective [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s