External application are consuming Salesforce enterprise wsdl and planning to create a feeditem record associated to a (Parent as) custom object.

In our case, they are going to create the feeditem every time on the same custom object and we have an external id (unique) field on the custom object.

To implement this, they have to make 2 calls:

  1. Query to get the parent id of the custom object record (based on the external id)

  2. Then create the feeditem record with Parentid as the custom object record id

I believe this may not be possible, but still raising this question for any ideas or expert advice.

Is there a way create a feeditem record associated to a parent record (which is a custom object) all in one SOAP webservice call using enterprise wsdl.

Below is a sample XML: (This does not work as the relationship to custom object does not exist)

Secure_Communication__c - Is the custom object

        <urn:sObjects xsi:type="urn1:FeedItem"> <!--Zero or more repetitions:-->
           <!--You may enter ANY elements at this point-->
           <Body>TEST MESAGE FROM PORTAL2</Body>

1 Answer 1


I'd usually suggest the approach from create() and Foreign Keys. However, in the case of FeedItem the relationship is polymorphic.

I did find this in upsert() and Polymorphic Foreign Keys:

A polymorphic key is an ID that can refer to more than one type of object as a parent. For example, the OwnerId field on the Case object can reference either a User or a Group. Similarly, the WhoID field on the Task object can reference either a Contact or a Lead.

With the Enterprise WSDL, such polymorphic foreign key fields are defined as a Name sObject type, so it is not possible to pass in the correct sObject in an upsert() call. However, with the Partner WSDL all foreign key fields—including polymorphic ones—are of type sObject , which allows upsert() calls on such fields.

If your organization has SOQL Polymorphism enabled, polymorphic relationship fields point to sObjects and not Names in the Enterprise WSDL; therefore, you can pass the correct sObject in a call. SOQL Polymorphism is currently available as a Developer Preview. For more information on enabling SOQL Polymorphism for your organization, contact Salesforce

So you might need to use the Partner API if you want to do this in one API call.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .