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

Using External ID's in API calls

Please confirm if we can create and assign tasks to an existing Account in using API calls and by referencing only the External ID's in such call and not any of the ID's like Account ID 


Based on the example provided below it appears to be possible, but I would like to have it confirmed as I am not familiar with API's.


public void upsertForeignKeySample()
  Opportunity upsertOpportunity = new Opportunity();
  //To indicate the reference, attach an Account object, 
  //which has only the external ID field specified.
  Account upsertParentAccountRef = new Account();
  //Set the external ID for the Opportunity
  UpsertResult[] upsertResults = binding.upsert("SAP1_OPPID__c", 
            new SObject[] {upsertOpportunity});
  // check results and do more processing after the upsert call ...
Message Edited by Expo on 09-22-2009 04:13 AM
Yes, it should be possible.