function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Irene SlessIrene Sless 

Outlook Task sync - Outlook 'Completed' Task not reset to 'In Progress' by SF

I have Salesforce for Outlook setup with the configuration set to 'Sync both ways' and conflict settings to 'Salesforce always wins'. Field mappings are correct.

We auto generate Tasks for Opportunities - a Sales Rep is assigned to follow-up an Opp and is assigned a Task for this. A custom field on the Task sets a flag to indicate that this is a 'follow-up' task. This flag is to separate it from any other Tasks that might be created for the same Opp that are not related to the 'follow-up', and this flag is controlled by trigger code only (or the Administrator manually).

A Sales Rep may not mark this type of Task as 'Completed' - the system trigger does this when the Stage is set to a 'Closed' stage. My problem is that the Sales Reps use mostly Outlook for updating their Tasks, and I can't control them clicking the 'Completed' option in Outlook. 

I created a 'before update' trigger on Tasks in SF, which checks the 'follow-up' custom field flag. If this is still set to 'active' if a Task is marked as 'Completed', it resets the Status field to 'In progress' and generates an error. 

The trigger catches the Outlook update and resets the SF Status to 'In progress' correctly in the SF Task when Outlook has changed it to 'Completed', but my problem is it doesn't reset the Outlook Task's status. It leaves it as 'Completed' in Outlook. I would expect the 'Salesforce always wins' conflict settings to update the Outlook Task with what's in SF, but it doesn't.

The Sync log says this:
2015-03-16 10:45:16,344 INFO  Time zone details -> Salesforce Region: Pacific/Auckland. Salesforce Identifier: (GMT+13:00) New Zealand Daylight Time (Pacific/Auckland). Windows Offset: 13:00:00. Windows Identifier: New Zealand Standard Time. Is Windows Daylight Savings: True
2015-03-16 10:45:16,346 INFO  [Task] *********** Starting Sync *********** 
2015-03-16 10:45:16,347 INFO  [Sync] Direction:Sync Conflict Setting:SFDCWins
2015-03-16 10:45:16,349 INFO  [Task]SyncEngine status changed to GettingSalesforceChanges
2015-03-16 10:45:16,353 INFO  [Task]SyncEngine Status: received 0 creates, 0 updates, 0 deletes, and 0 errors from Sfdc Sync Connector
2015-03-16 10:45:16,354 INFO  [Task]SyncEngine status changed to GettingOutlookChanges
2015-03-16 10:45:16,407 INFO  [Task]SyncEngine Status: received 2 creates, 1 updates, 0 deletes, 0 unmapped items, and 0 errors from Outlook Sync Connector
2015-03-16 10:45:16,409 INFO  [Task]SyncEngine status changed to Matching
2015-03-16 10:45:16,410 INFO  Matching 2 Outlook records to Salesforce records by stored SFDC Record ID.
2015-03-16 10:45:16,411 INFO  Retrieving 0 SFDC Records by ID for matching by ID.
2015-03-16 10:45:16,433 INFO  [Task]SyncEngine status changed to DoingConflictDetection
2015-03-16 10:45:16,435 INFO  [Task]SyncEngine status changed to ApplyingSalesforceChanges
2015-03-16 10:45:16,436 INFO  [Task] Filtered 2 Outlook creates based on selective sync settings.
2015-03-16 10:45:16,436 INFO  [Task] Applying changes to Salesforce: 0 creates, 1 updates, 0 deletes
2015-03-16 10:45:17,195 ERROR [Task] Update  to SFDC gave error(s) Sfdc.Server.SfdcServerCreateUpdateException: This Task cannot be completed while it is still active for a Follow-Up!
 for Outlook record Follow-Up on Quote: Quote 535853
2015-03-16 10:45:17,197 INFO  [Task]SyncEngine status changed to ApplyingOutlookChanges
2015-03-16 10:45:17,199 INFO  [Task]Applying changes to Outlook: 0 creates, 0 updates, 0 deletes
2015-03-16 10:45:17,200 INFO  [Task] 1 records being updated with post-sync updates
2015-03-16 10:45:17,214 INFO  [Task]SyncEngine status changed to Finished
2015-03-16 10:45:17,318 INFO  [Task] *********** Finished Sync *********** 

Outlook's Status does not change to 'In Progress' as it is in SF.

User-added image
User-added image

Every subsequent run of the sync process thows the same conflict error and leaves the 2 Tasks NOT synced. 
What am I doing wrong or what should I do to have this working correctly?
Irene SlessIrene Sless
I've gone a different route and have cloned the task to a new one, and let the old one go, as it seems one can't do anything when it's marked as 'completed'.