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
SherryASherryA 

API Support

I have inherited code that calls the API to create a task on a lead.  This code has been working in production and has not changed.  But, on occasion, it seems to give me an integrity constraint in error that looks something like...
 

field integrity exception: WhoId, WhatId (cannot specify whatID with lead whoID)

I am creating a task on a lead (referenced in the whoId), and the whatId is not populated (its null).

The confusion I'm having is when I call SFDC Tech Support, they seem to have no idea what I'm talking about when I say I'm calling the API.  Any ideas why that is?  Or...even better...has anyone seen this kind of sporadic behavior?

Thanks for any thoughts.

 

 

werewolfwerewolf
Well, are there any conditions under which you might be specifying a WhatId?  The error message is correct -- if the WhoId is a lead, WhatId must be null.
paul-lmipaul-lmi
i'm not fully familiar with associations, but isn't the whoid the user the task is assigned to, and the whatid the sf object it's associated with?

in regards to support...you only get development support with a larger account or premier support service..  to give you an example, i manage a 40 seat enterprise account, and our options are to upgrade to unlimited and add 10 more seats to get it, or buy premier support, which is a significant chunk of money (and close to what unlimited would cost now).
werewolfwerewolf
The WhoId refers to a Contact, Lead or Person Account.  The WhatId is any other activity-able object.  However, if the WhoId is a Lead, the WhatId cannot be specified (because when the lead gets converted the WhoId will turn into the newly created Contact and the WhatId will become the Opportunity).
SherryASherryA
Thank you for your information, but I already know this...The WhoId I am passing is a lead and the WhatId is null...so, I'm getting the integrity error in error (the conditions are all met).
 
here is chunk of the errormessage and xml...
 

<Description>SFDCEventHandler Processing Failure. SFDC Task will not be created. Exception of type 'System.Exception' was thrown. field integrity exception: WhoId, WhatId (cannot specify whatID with lead whoID)</Description>

<Message>

<Task ExternalId="xxx" InternalId="" xmlns="xxx/">

<OwnerId>00550000000rViA</OwnerId>

<WhoId>00Q7000000M1TTp</WhoId>

<WhatId />

<Status>Ordered</Status>

<Description>Order processed through the tool.</Description>

<Subject>Fulfillment Order</Subject>

<DueDate>2008-05-01</DueDate>

<Items xmlns="">

<Item>

<Items_Included_ID__c>KIT-xxx</Items_Included_ID__c>

<Items_Included__c>INTRO BROCHURE KIT</Items_Included__c>

</Item>

<Item>

<Items_Included_ID__c>SPOT CUSTOM LETTER</Items_Included_ID__c>

<Items_Included__c>CUSTOMIZED LETTER FROM THE SPOT</Items_Included__c>

</Item>

<Item>

<Items_Included_ID__c>BC-xxx-01</Items_Included_ID__c>

<Items_Included__c>

</Items_Included__c>

</Item>

<Item>

<Items_Included_ID__c>--ExxxPLACEHOLDER--</Items_Included_ID__c>

<Items_Included__c />

</Item>

</Items>

</Task>

</Message>

</ns0:Alert>

</ns0:Notification>

 
 


Message Edited by SherryA on 05-01-2008 11:07 AM
SherryASherryA
Thank you for your support information.  I guess I'm a little surprised that tech support cannot/did not tell me that!  (Its an easy answer to say we cannot help you since you didn't buy this support option).
SuperfellSuperfell
What does the actual API request look like? do you have any apex triggers that may be trying to set a whatId ?
SherryASherryA
great questions...let me see if I can tell about the API request...its buried in a Biztalk orchestration process that calls it (of which I also inherited)...so I've been unable to see it exactly, but I will definitely try to trace the code.  Also, as far as looking at apex triggers, I need to ask our SFDC people here (and they aren't very technical, so they might not be able to tell me)...but I'm also going in search of that now...


Message Edited by SherryA on 05-01-2008 02:44 PM
emitromemitrom

Hi,

 

I have the documentation on this and can see where this is coming from but I need to be able to hook up a custom object - where would I do that with a lead object?

 

With the Contact - Task - custom object via the WhatID made sense but how do I associate the custom object ID with a Lead? I cannot see any other ways as I am a newbie to salesforce using the APEX WSDL apis.

 

Is there a way or am I stuffed?  I have looked around at the other obejcts to see if I can do anything else simliar with Campaign object or Tags but don't know enough to be sure I am working within the 'normal' framework if you see what I mean. :)

 

Any ideas?

 

Thanks!

 

werewolfwerewolf

emitrom,

 

I don't understand your question.  Are you just trying to associate a Task with a Lead and a custom object?  You can't do that.

emitromemitrom

hi werewolf,

 

Yes that is exactly my problem. I can make the following connections of

 

Contact - Task - Custom Object

 

 

but cannot do

 

Lead - Task X Custom Object

 

So for now that only way I can link the Task and lead to the Custom Object is to include the URL in the description field. Which obviously is a bit clunky and I was hoping there was a better way?

 

 

Either way at least the user can select the object now but obviously I have the problem of configuring the correct URL for the account i.e. https://na6 or whichever.

 

Ideas?

 

Martha_SenetaMartha_Seneta

Despite SF documentation to the contrary, I found that I am able to link a Task to both a WhoId (a Lead) and a WhatId (in my case, an Account - but I expect it would work for custom objects as well), but it only works on update, not on insert.  (Insert generates the error that SherryA mentioned in her original post.)

 

I want my WhatId populated on insert as well as update, so as a workaround I'm trying out having a trigger perform an update operation (without making any changes) to any Lead Tasks that are being inserted.  That update operation then triggers a call to the code that populates the WhatId.  Seems to be working so far . . .