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
SFDC LearnSFDC Learn 

How to update External Object from Salesforce using apex?

Hello

Is there a way to update External object  record using Apex . I have to update external object record after creation a record in salesforce? 
_Zach Boyd_Zach Boyd
Here is an offical Salesforce doc on writing to external objects. The example shows using Database.insertAsync, however you should be able to use Database.updateAsync based on what you are describing above. Please mark as correct if possible so others can use in the future. Thanks!

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_connector_external_objects_write_features.htm
SFDC LearnSFDC Learn
@_Zach Boyd  thank you for you Response.  The link was useful.I have another question can i update External objet record  after insert a record in salesforce.
Ex: I have a trigger on object x whihc will create a record in y after creation of record y i need to update External object. Will it be possible in same transaction ??
_Zach Boyd_Zach Boyd
Unfortunately, I do not have an external system to test with, but this link documents the limits and considerations when writing to an external object.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_connector_external_objects_write_limitations.htm

The link above mentions the following

The API can’t save changes to an external object and a standard or custom object within the same transaction.