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
Alister RollinsAlister Rollins 

Error on upsert/create Junction object via API

Hi, I'm having trouble creating or upserting a junction object via the API, the object is custom.
The problem seems to be restricted to junction objects (when it has 2 Master-detail relationships in it), because any other type of custom object works perfectly fine.

Here's a successful XML request :

<soap:Body>
<sforce:upsert xmlns:sforce="urn:partner.soap.sforce.com" xmlns:sfons="urn:sobject.partner.soap.sforce.com">
  <sforce:externalIDFieldName xsi:type="xsd:string">ID</sforce:externalIDFieldName>
  <sObjects xsi:type="sforce:AcctAttnAssoc__c">
   <sforce:AttendanceDetails__c xsi:type="xsd:string">a194000000040deAAA</sforce:AttendanceDetails__c>
   <sforce:Name xsi:type="xsd:string">randomname</sforce:Name>
   <sforce:Account__c xsi:type="xsd:string">0014000000rE6moAAC</sforce:Account__c>
  </sObjects>
</sforce:upsert>
</soap:Body>

And here's an unsuccessful XML request:

<soap:Body>
<sforce:upsert xmlns:sforce="urn:partner.soap.sforce.com" xmlns:sfons="urn:sobject.partner.soap.sforce.com">
  <sforce:externalIDFieldName xsi:type="xsd:string">ID</sforce:externalIDFieldName>
  <sObjects xsi:type="sforce:Attendance_Log__c">
   <sforce:Attendance__c xsi:type="xsd:string">a1340000008DlmxAAC</sforce:Attendance__c>
   <sforce:Name xsi:type="xsd:string">randomname</sforce:Name>
   <sforce:Account__c xsi:type="xsd:string">0014000000rE6moAAC</sforce:Account__c>
  </sObjects>
</sforce:upsert>
</soap:Body>

As mentioned before, the only difference is that AcctAttnAssoc__c has 2 Master-detail relationships in it (Attendance__c & Account__c).
The error I get back is:

Fatal error: INVALID_TYPE: sObject type 'AcctAttnAssoc__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

Please let me know if you need any more details, thanks.
Best Answer chosen by Alister Rollins
Alister RollinsAlister Rollins
Here's the solution if anybody else has the same issue:

The API version used needs to be 13.0 or above to handle junction objects.