1

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

<soapenv:Body>
     <urn:create>
        <urn:sObjects xsi:type="urn1:FeedItem"> <!--Zero or more repetitions:-->
           <!--You may enter ANY elements at this point-->
           <Body>TEST MESAGE FROM PORTAL2</Body>
           <ParentId>a0L550000014TAy</ParentId>
        </urn:sObjects>
      <urn1:Secure_Communication__r>    
 <Legacy_Secure_Communication_ID__c>982918</Legacy_Secure_Communication_ID__c>
       </urn1:Secure_Communication__r> 
     </urn:create>
  </soapenv:Body>
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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.