I am required to write a trigger on the tasks created as a result of email sync from Outlook.But the problem is that I am not being able to differentiate between other tasks and the tasks created as a result of Email sync from outlook to salesforce. Is there any field that can let me know that whether the task was created as a result of email sync or other way?
By default, there's no distinction. The best solution to differentiate the tasks created from the Outlook to Salesforce sync vs. other tasks is to have a custom field which gets populated during the sync process. This can be a boolean flag or you can store any other sync information which may come in handy at a later stage.
The sync works based on
Due Date. To find more details on how to control the specific task/ field syncing behavior, read here.