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
rd7rd7 

Lead and Campaign

I am adding a lead using the 'create' request.  This is successful but I am unclear about the field 'Campaign'.  If I try to populate that field with a campaign name or id the error I get is:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <createResponse>
         <result>
            <errors>
               <message>Invalid foreign key relationship name Campaign</message>
               <statusCode>INVALID_FIELD</statusCode>
            </errors>
            <id xsi:nil="true"/>
            <success>false</success>
         </result>
      </createResponse>
   </soapenv:Body>
</soapenv:Envelope>

SuperfellSuperfell
There is no campaign field (in the api). If you want to relate the lead to a campaign, insert a row in the CampaignMember table.