Google Calendar Sync

Hello
I am new suiteCRM

I recently successfully installed suiteCRM on xampp windows 10.

I want to sync google calendar with my suitecrm
I tried this document:
https://docs.suitecrm.com/admin/administration-panel/google-sync/

I have done everything as is, but nothing happened.
no synchronization what so ever.
Does anyone ever get it to work?
Can you please help?

It works for me.

I also have it working by following the instructions. Just so you know all it does is sync meetings to gmail calendar. It doesn’t bring any of google calendar into Sutiecrm or sync tasks or calls or anything else. Just pushes meetings to google calendar. At least that’s all it does for me.

It’s suppose to be bi-sync, right?
Doesn’t it sync events as well?
I am confused by the term meeting.

Sorry yes it will sync “events” as defined in SuitCRM as “events” and “meetings” as defined in SuiteCRM as a “meeting” I haven’t been able to get any other data from google calendar or push any other data to google calendar. So for example an event created in Google Calendar is not seen on my calendar in SuiteCRM unless it was an “event” or a "meeting’ created in SuiteCRM. At least that’s all I’ve been able to get it to do. If you’ve done more, I’d love to know how.

1 Like

It’s programmed to be a bi-directional sync between your SuiteCRM meetings, and the Google calendar labeled ‘SuiteCRM’.

If it’s not syncing a meeting you created on Google Calendar, make sure that meeting is in the SuiteCRM calendar and not the default one.

When I create a meeting in SuiteCRM, it creates one in Google Calendar. However, when I create one in Google Calendar (in the SuiteCRM Calendar) it does not sync (or even push to) SuiteCRM.

I’ve tried disconnecting and re-connecting the google calendar permissions in my user account and also in the admin settings. Doesn’t seem to help. I keep getting this error in the log:

[3][1][FATAL] Caught Exception While Syncing User:1

There’s no other info, so I don’t know why it’s failing.

Try setting your log level to debug, then checking what it logs. If it’s catching an exception, we should be able to tell by the exception code.

So it goes and skps a bunch of records (guessing these are in the past). I don’t think it finishes all the records and the I get this…

Wed Oct 9 17:10:52 2019 [3][1][FATAL] Caught Exception While Syncing User:1
Wed Oct 9 17:10:52 2019 [3][1][ERROR] #0 /vendor/google/apiclient/src/Google/Http/REST.php(94): Google_Http_REST::decodeHttpResponse(Object(GuzzleHttp\Psr7\Response), Object(GuzzleHttp\Psr7\Request), ‘Google_Service_…’)
#1 /vendor/google/apiclient/src/Google/Task/Runner.php(176): Google_Http_REST::doExecute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), ‘Google_Service_…’)
#2 /vendor/google/apiclient/src/Google/Http/REST.php(58): Google_Task_Runner->run()
#3 /vendor/google/apiclient/src/Google/Client.php(808): Google_Http_REST::execute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), ‘Google_Service_…’, Array, NULL)
#4 /vendor/google/apiclient/src/Google/Service/Resource.php(232): Google_Client->execute(Object(GuzzleHttp\Psr7\Request), ‘Google_Service_…’)
#5 /vendor/google/apiclient-services/src/Google/Service/Calendar/Resource/Events.php(77): Google_Service_Resource->call(‘get’, Array, ‘Google_Service_…’)
#6 /home/pablostevens71/suitecrm.igosalesandmarketing.com/include/GoogleSync/GoogleSyncBase.php(457): Google_Service_Calendar_Resource_Events->get(‘f6gck6ho2d1sbd0…’, ‘_6kp34dpg64o32b…’)
#7 /include/GoogleSync/GoogleSync.php(152): GoogleSyncBase->getGoogleEventById(’_6kp34dpg64o32b…’)
#8 /include/GoogleSync/GoogleSync.php(296): GoogleSync->doSync(1)
#9 /modules/Schedulers/_AddJobsHere.php(533): GoogleSync->syncAllUsers()
#10 /modules/SchedulersJobs/SchedulersJob.php(540): syncGoogleCalendar(Object(SchedulersJob))
#11 /include/SugarQueue/SugarCronJobs.php(191): SchedulersJob->runJob()
#12 /Include/SugarQueue/SugarCronJobs.php(231): SugarCronJobs->executeJob(Object(SchedulersJob))
#13 /cron.php(100): SugarCronJobs->runCycle()
#14 {main}
Wed Oct 9 17:10:52 2019 [3][1][WARN] /include/GoogleSync/GoogleSync.php:308 GoogleSync::syncAllUsers - 1 failure(s) found at syncAllUsers method.

also these…

(I checked I don’t have any meetings with either of these IDs)

Wed Oct 9 17:30:42 2019 [3][1][FATAL] Mysqli_query failed.
Wed Oct 9 17:30:42 2019 [3][1][FATAL] Query Failed: UPDATE meetings SET gsync_id = ‘’ WHERE id = 858cd069-e4aa-28a7-594c-575ecf020117: MySQL error 1054: Unknown column ‘858cd069’ in ‘where clause’
Wed Oct 9 17:30:42 2019 [3][1][FATAL] /include/GoogleSync/GoogleSyncBase.php:709 GoogleSyncBase::delEvent - Failed to remove gsync_id from record858cd069-e4aa-28a7-594c-575ecf020117
Wed Oct 9 17:30:42 2019 [3][1][FATAL] Mysqli_query failed.
Wed Oct 9 17:30:42 2019 [3][1][FATAL] Query Failed: UPDATE meetings SET gsync_id = ‘’ WHERE id = 2020f7a4-b94a-0223-ef04-58b45906dddc: MySQL error 1054: Unknown column ‘2020f7a4’ in ‘where clause’
Wed Oct 9 17:30:42 2019 [3][1][FATAL] /include/GoogleSync/GoogleSyncBase.php:709 GoogleSyncBase::delEvent - Failed to remove gsync_id from record2020f7a4-b94a-0223-ef04-58b45906dddc

pstevens,

Could you try something for me?

Edit the file include/GoogleSync/GoogleSyncBase.php
Line 690 should currently look like this:

$valMeetingId = $this->db->quote($meeting_id);

Change it to:

$valMeetingId = $this->db->quoted($meeting_id);

Notice the change is from ‘quote’ to ‘quoted’.

See if that resolves the issue. If it does, I’ll add the fix to the patch I already have submitted for another syncing fix. If not I’ll figure out how to properly fix the issue.

2 Likes

Thank you so much for your help. I’ve made the change but still get the same error. From the debug, it looks like its running though all the SuiteCRM meetings and skipping them (probably because they’re already synch’d). I think when it starts to try and grab the Google calendar stuff is when the problem starts.

I’ve double checked the debug log and it’s the exact same error.

Okay I have one more idea.
Change that line back. Then go to line 706.
Change it from this:

$sql = "UPDATE meetings SET gsync_id = '' WHERE id = {$valMeetingId}";

To this:

$sql = "UPDATE meetings SET gsync_id = '' WHERE id = '{$valMeetingId}'";

Notice the single quotes added around {$valMeetingId}

This is to fix the “Query Failed: UPDATE” error. The meeting ID needs to be quoted.

Ok so the second error about the failed DB query is now gone, but the first error is still there an no sync from Google to SuiteCRM (the other way works).

#1 /vendor/google/apiclient/src/Google/Task/Runner.php(176): Google_Http_REST::doExecute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), ‘Google_Service_…’)…etc,

Its the same error.

Ok, that’s good that the Sql Query error is gone. Now we need to repair the damage in the DB.

Are you comfortable running SQL commands?

You need to delete the SuilteCRM calendar in Google, then run this on your SQL server:

 UPDATE meetings SET gsync_id = NULL, gsync_lastsync = NULL WHERE assigned_user_id = '1';

Then the next time it syncs the calendar will be recreated and all the events in CRM will sync to Google. However, if you have any non-synced events that only exist in Google, they will be lost. There’s a way to target the specific event that’s causing the issue, but it’s more involved.

If you’re able, you can join me at https://gitter.im/SuiteCRM_AC/community and we can have a real time chat about it.

Thanks Benjamin! We worked it out, turned out some adjustments were needed due to I’m on an older version of MySQL. Ben’s going to push out the changes in the next update if anyone else is having this issue.

I’ve now been able to sync both ways from SuiteCRM to Google and from Google back to SuiteCRM.

Hi.

I’m using 7.11.7.

Meetings on SuiteCRM get synced to Google calendar but it does not work the other way around.
However, when I delete a synced even from Google calendar it gets deleted from SuiteCRM.

Any help would be appreciated.

Also, do only meetings/events get synced with Google?

I think I may have your answer. Meetings in Google Calendar don’t sync back to SuiteCRM unless you add them to the SuiteCRM calendar in Google Calendar. You should see two calendars in your Google Calendar. One is your name, the other is SuiteCRM. If the meeting is not in the SuiteCRM calendar it will non sync. If you open a meeting in Google Calendar, click on “more actions” in top right hand corner then “copy to SuiteCRM” it will create a duplicate event in your Google Calendar that in your SuiteCRM calendar. Then it will sync.

Not sure if that’s your issue, but I found this confusing also. Long story short, it doesn’t sync your personal calendar in Google, ONLY the SuiteCRM calendar in Google (if that makes sense!)

I thought that would be the issue.
But I double checked and I am creating the events under the SuiteCRM calendar.