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
Daniel WrayDaniel Wray 

FIELD_INTEGRITY_EXCEPTION CONTACT\LEAD ID: id of incorrect type 0053*********fmAAA

Hi, I am recieving a " FIELD_INTEGRITY_EXCEPTION CONTACT\LEAD ID: id of incorrect type 0053*********fmAAA" exception when trying to create a task for the person logged in.  I am passing a 18 digit character/number string of the person logged in.
Here's the code:
//create activity on account to record update
var newActivity = new Sforce.Dynabean("Task");
newActivity.set("Subject", "message " + variable);
newActivity.set("WhoId", accId);
newActivity.set("Status", "Completed");
newActivity.set("Priority", "Normal");
newActivity.set("Description", variable);
var today = new Date();
newActivity.set("ActivityDate", today);
// no brackets!! hasnt worked
var saveResult = sforceClient.Create(newActivity)[0];
// no brackets no [0] hasnt worked 
var saveResult = sforceClient.Create(newActivity);
// original code not working
var saveResult = sforceClient.Create([newActivity])[0];
I would really apreciate if someone could help, thanks!!  Anita

You are passing in an id for a user, but "whoid" is for Contacts.   (Do a search on on whoid, there's been threads describing its use).

You probably want to set the ownerId instead.

Daniel WrayDaniel Wray
Thank you so much all working fine now!!! :smileywink: You got it spot on cheers!!