diff --git a/lib/services/entity-sync.ts b/lib/services/entity-sync.ts index 2fd77a8..13c371e 100644 --- a/lib/services/entity-sync.ts +++ b/lib/services/entity-sync.ts @@ -85,7 +85,10 @@ export class EntitySyncService { let params: any = {}; // For incremental sync, filter by last sync time - if (isIncremental) { + // Note: Companies and Resources don't support date-based filtering in Autotask API + const supportsIncremental = entity !== EntityType.COMPANIES && entity !== EntityType.RESOURCES; + + if (isIncremental && supportsIncremental) { try { const lastSyncTime = await getLastSyncTime(entity); if (lastSyncTime) { @@ -99,6 +102,8 @@ export class EntitySyncService { entityLogger.error('Failed to get last sync time', {}, err); throw new Error(`Failed to determine sync time: ${err.message}`); } + } else if (isIncremental && !supportsIncremental) { + entityLogger.info(`${entity} does not support incremental sync, performing full sync instead`); } else { // For full sync, build filters const filters: Array<{ field: string; op: string; value: any }> = [];