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
Micah PowellMicah Powell 

DUPLICATE_VALUE error when upserting Task

I'm having a strange issue when upserting a task. I am using an external id to insert/update the Task and the upsert works on most occasions except for one. 

If I insert a Task WITHOUT a WhoId, and then upsert the task with a user other than the one used to create the task ( createdById ), I get the DUPLICATE_VALUE error. However, it I insert a Task WITH a WhoId, and then upsert the task with a user other than the one used to create the task, everything works as expected.  If I insert a Task WITHOUT a WhoId, and then upsert the task with the user that created the task, everything works fine. 

My question is, is there some sort of strange upsert permission and if so, why does it matter if there is a whoId or not?

Any help is much appreciated.

venkat-Dvenkat-D
Check for the field thas has Unique property enforced and see the logic of that field population. My guess is its different based on if WhoId is populated or whether WhoId is same as createdbyId.