Extension version: Outlook Integration 1.7.0 and 1.7.1 (confirmed identical code in the affected files between these two versions)
EspoCRM version: 9.3.8
PHP version: 8.4.21
Database: PostgreSQL
Expected behavior:
When Services/OutlookCalendar::getExternalAccountForSync() returns null (which it does deliberately for several legitimate cases: no userId on the OutlookCalendarUser, user not found, no ExternalAccount record, account not enabled / outlookCalendarEnabled off, no calendarDirection set, ACL check failing, connection ping failing, or scope check failing), the sync for that user should simply be skipped without an error.
Actual behavior:
A TypeError is thrown and logged at ERROR level every time the scheduled job "Sync Outlook Calendar" runs (default every 3 minutes) for any OutlookCalendarUser whose getExternalAccountForSync() returns null:
...
Steps to reproduce:
EspoCRM version: 9.3.8
PHP version: 8.4.21
Database: PostgreSQL
Expected behavior:
When Services/OutlookCalendar::getExternalAccountForSync() returns null (which it does deliberately for several legitimate cases: no userId on the OutlookCalendarUser, user not found, no ExternalAccount record, account not enabled / outlookCalendarEnabled off, no calendarDirection set, ACL check failing, connection ping failing, or scope check failing), the sync for that user should simply be skipped without an error.
Actual behavior:
A TypeError is thrown and logged at ERROR level every time the scheduled job "Sync Outlook Calendar" runs (default every 3 minutes) for any OutlookCalendarUser whose getExternalAccountForSync() returns null:
...
Steps to reproduce:
- Install/enable the "Outlook Integration" extension (v1.7.0 or v1.7.1).
- For a user, connect Outlook (ExternalAccount with id Outlook__{userId}) and enable calendar sync, selecting a calendar — this creates an active OutlookCalendarUser record.
- Put the external account into a state where getExternalAccountForSync() returns null while the OutlookCalendarUser stays active — e.g. disable the connection's "Enabled" toggle, or leave calendarDirection unset, or let the connection check (ping) fail.
- Wait for the "Sync Outlook Calendar" scheduled job to run (every 3 minutes by default), or trigger it manually via Administration > Scheduled Jobs.
- Check data/logs/espo.log for the current date — the TypeError above appears for this user on every run.

Comment