You need to sign in to do that
Don't have an account?
Need help getting web service update using foreign key to work
According to the SFC documentation, if I designate a field in my custom object as an external id ( which I did), and then set the value of the field in the webservice (which I did), that SFC will perform the udpate using the foreign key instead of a SFC Id ( this did not happen).
I have a custom object called : dmb_survey__c
I checked field for external id: project_task_id__c
I set the field value in my web service code :
dmb.project_task_id__c = row.task_id;
I call the SFC update :
SaveResult[] saveResults = binding.update(updateArray);
SFC returns the following error message:
"ERROR Message: Id not specified in an update call"
Well, its not specified because SFC claims you do not need it if you have a foreign key. What am I missing here?
Is project_task_id__c a numeric field, are you using .NET, if so you need to set the specified flag (project_task_id__cSpecified = true), see the sticky in the .NET board.
All Answers
You have to call upsert.
If I have to use Upsert that forces me to only do one update at a time as it seems to require me to send it the actual value
of the foreign key instead of just saying find the foreign key in this field. Is that correct? Or is there a way to pass
an entire array?
Thanks for your help Simon
Here is the documenation from SFC that implies you can use update:
I am using upsert but I am getting an error message. I call upsert like this:
But SFC sends back an error that states: project_task_id__c not specified.
I am still setting the value in my code
And my log shows I am populating the value:
Project task id 668152
Using update you can use the externalId of related records to set foreign key values, but you need to specify the salesforce.com Id of the actual record being updated. (as per the sample code you posted, it sets the salesforce.com id of the opportunity being updated, but uses the externalId field on the account to set the account relationship of the opportunity.
Is project_task_id__c a numeric field, are you using .NET, if so you need to set the specified flag (project_task_id__cSpecified = true), see the sticky in the .NET board.
Simon,
That was the solution to the problem. Thank you so much! I could have been pulling my hair out days
and babbling to myself "there is nothing wrong with this code...."
You saved the day!