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


Hi , 
How can i Update a record from Apex using External Id . 
Ex :
Account Object 

ExternalId__c =123;//unique
name ='AccountName';

Not able to use Update 

Account a = new Account ();
a.ExternalId =123; = 'EditedName';

Update a;

when  i use this i am getting an Error saying to update Id field is required. 

Any help will be appriciated .

Instead of the Update dml statement, you can use Upsert .

Satish Kumar
I Dont want to Create a new Record . I only want to Update my Existing Accout without using AccountId . Just wanted to use ExternalId.
My ExternalId Field is Unique. 
I Already have that Record with ExternalId =123;