+ Start a Discussion
SFDC LearnSFDC Learn 

How to update External Object from Salesforce using apex?


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!

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.


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.