SlideShare a Scribd company logo
Two-Way Integration with
Writable External Objects
​ Alexey Syomichev
​ Architect
​ asyomichev@salesforce.com
​ @syomichev
​ 
​ Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
​ This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties
materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed
or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-
looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any
statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new,
planned, or upgraded services or technology developments and customer contracts or use of our services.
​ The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new
functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our
operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any
litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our
relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our
service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger
enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our
annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter.
These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section
of our Web site.
​ Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available
and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features
that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Safe Harbor
​ Extract-Transform-Load (ETL) approach to data
integration does not always work:
§  Has to be driven by an ETL system;
§  Synchronized dataset goes stale immediately;
​ 
External Objects allow data integration without
physically moving the data:
§  Back-office data is always up to date;
§  Now includes write access!
External Objects
​ Data Federation on Salesforce Platform
1.  Example of integration architecture
2.  External Data Source configuration
3.  Editing external objects
4.  Writing to external objects via API
5.  Writing to external object in Apex
6.  Questions
Session outline
Use case
Example architecture
​ Throughout this session we will be exploring an example integration consisting of:
§  Account data maintained in Salesforce;
§  Order data maintained in back-office system;
§  Relationship is by a business key
Data Integration Example
Setup
Data Source configuration parameters
​ Enable external writes using a
new checkbox in data source
parameters.
​ To be configured as writable,
an OData service must
support additional HTTP verbs:
§  POST
§  PUT
§  MERGE/PATCH
§  DELETE
Configuration
Create, Edit, Delete
Making changes in external data via UI
§  Standard UI for
Edit, Create, Delete
§  Remote save is requested
immediately
§  Any remote failure
manifests as a user-visible
error
Editing external objects
§  Create, Edit and Delete also
supported in mobile UI
Mobile editing
API
Saving or deleting external data via sObject API
§  Workbench
§  SOAP API
§  REST API
Multi-object save has to be
homogeneous:
§  Transaction boundaries
§  “AllOrNothing” semantics
External writes with API
Apex
Building complex data modification scenarios
​ Apex allows to build logic that involves
multiple related data modifications.
§  Local changes are added to the transaction
and are committed together at the end of
Apex context.
§  Remote changes are not tied to the
transaction, and cannot be requested
immediately while there is a local
transaction open.
​ Account acct = new Account(name = “SAP”);
​ insert acct;
​ Opportunity oppt = new Opportunity(account = acct);
​ insert oppt;
​ SalesOrder__x order = new SalesOrder__x();
​ order.account = acct;
​ insert order;
Complex scenarios
No distributed transactions or two-phase commit:
§  Salesforce core database has ACID properties:
§  Atomic
§  Consistent
§  Isolated
§  Durable
§  External writes follow BASE semantics:
§  Basically available
§  Soft state
§  Eventually consistent
Transactional Semantics
In class System.Database there are new operations exclusively for external objects:
-  For insert, update and delete;
-  Of “immediate” and “async” behavior;
-  Async operations come with or without callback option
External CRUD operations
	
  
Database.insertImmediate(obj);	
  
	
  
Database.insertAsync(obj);	
  
	
  
Database.insertAsync(obj,	
  cb);	
  
	
  
Database.updateImmediate(obj);	
  
	
  
Database.updateAsync(obj);	
  
	
  
Database.updateAsync(obj,	
  cb);	
  
	
  
Database.deleteImmediate(obj);	
  
	
  
Database.deleteAsync(obj);	
  
	
  
Database.deleteAsync(obj,	
  cb);	
  
Database.insertAsync()
​ public void createOrder() {
​  SalesOrder__x order = new SalesOrder__x();
​  Database.SaveResult sr = Database.insertAsync(order);
​  if (!sr.isSuccess()) {
​  String locator = Database.getAsyncLocator(sr);
​  completeOrderCreation(locator);
​  }
​ }
​ @future
​ public void completeOrderCreation(String locator) {
​  SaveResult sr = Database.getAsyncResult(locator);
​  if (sr.isSuccess()) {
​  System.debug(“sales order has been created”);
​  }
​ }
Asynchronous callback
​ global class SaveCallback extends DataSource.AsyncSaveCallback {
​  override global void processSave(Database.SaveResult sr) {
​  if (sr.isSuccess()) {
​  System.debug("Save complete: Id = " + st.getId());
​  }
​  }
​ }
public void createOrder() {
​  SalesOrder__x order = new SalesOrder__x();
​  SaveCallback callback = new SaveCallback();
​  Database.updateAsync(order, callback);
​ }
​ Asynchronous external writes follow the eventual consistency model with BASE semantics,
as opposed to ACID semantics of Salesforce core DB:
§  Reads performed shortly after writes may not reflect the changes
§  Writes will eventually reach the remote system
§  Even when Salesforce is the only writing system, remote data may change over time
without current input: as queued up changes flow out, repeated reads may return
different results
§  There is no ordering guarantees between writes issued from unrelated contexts
§  Conflict resolution strategy is up to the remote system, but in most naive configuration
the latest change to be applied wins
§  Coordinated changes can be orchestrated with compensating transactions
Consistency Model – Design Considerations
​ Asynchronous writes can be tracked by org admin in the BackgroundOperation sObject:
Monitoring
SELECT Id, Status, CreatedDate, StartedAt, FinishedAt, RetryCount, Error
FROM BackgroundOperation
WHERE Name = 'SalesOrder__x upsert'
ORDER BY CreatedDate DESC
§  External writes are synchronous when performed via API or UI
§  API save cannot mix external and regular objects
§  Apex code can perform external writes only via Database.insertAsync() et al.
§  Database.insertAsync() is separate to avoid confusion with transactional insert()
§  Asynchronous writes offer eventual consistency model
§  Apex code cannot use insert()/update()/create() on external objects
§  Apex code can supply callbacks for compensating actions
§  Admin can monitor background write via API/SOQL
§  Available in Winter’16
Summary
Share Your Feedback, and Win a GoPro!
3
Earn a GoPro prize entry for
each completed survey
Tap the bell to take a
survey2Enroll in a session1
Thank you

More Related Content

What's hot (20)

PDF
Ivan Gubynskyy Salesforce CRM and Platform Overview
LogeekNightUkraine
 
PDF
Getting started with Salesforce security
Salesforce Admins
 
PDF
Best Practices with Apex in 2022.pdf
Mohith Shrivastava
 
PPTX
Salesforce Development Best Practices
Vivek Chawla
 
PPTX
Salesforce Streaming event - PushTopic and Generic Events
Dhanik Sahni
 
PPTX
Real Time Integration with Salesforce Platform Events
Salesforce Developers
 
PPTX
Introduction to Apex for Developers
Salesforce Developers
 
PPTX
Salesforce admin training 1
HungPham381
 
PPTX
Profiles and permission sets in salesforce
Sunil kumar
 
PPTX
Introducing the Salesforce platform
John Stevenson
 
PPT
Security and Your Salesforce Org
Salesforce Admins
 
PPT
Data Management and Migration in Salesforce
Sunil kumar
 
PPTX
Supercharge your Salesforce Reports and Dashboards
NetStronghold
 
PPT
Salesforce Integration
Joshua Hoskins
 
PPTX
Introduction to Salesforce.com
Edureka!
 
PDF
Lwc presentation
Nithesh N
 
PPTX
Salesforce Security Best Practices for Every Admin
Cloud Analogy
 
PPTX
Salesforce CPQ Online Training
Prasannakumar898
 
PDF
Salesforce CPQ
Jade Global
 
PPTX
Salesforce PPT.pptx
ShaikAllabakshu5
 
Ivan Gubynskyy Salesforce CRM and Platform Overview
LogeekNightUkraine
 
Getting started with Salesforce security
Salesforce Admins
 
Best Practices with Apex in 2022.pdf
Mohith Shrivastava
 
Salesforce Development Best Practices
Vivek Chawla
 
Salesforce Streaming event - PushTopic and Generic Events
Dhanik Sahni
 
Real Time Integration with Salesforce Platform Events
Salesforce Developers
 
Introduction to Apex for Developers
Salesforce Developers
 
Salesforce admin training 1
HungPham381
 
Profiles and permission sets in salesforce
Sunil kumar
 
Introducing the Salesforce platform
John Stevenson
 
Security and Your Salesforce Org
Salesforce Admins
 
Data Management and Migration in Salesforce
Sunil kumar
 
Supercharge your Salesforce Reports and Dashboards
NetStronghold
 
Salesforce Integration
Joshua Hoskins
 
Introduction to Salesforce.com
Edureka!
 
Lwc presentation
Nithesh N
 
Salesforce Security Best Practices for Every Admin
Cloud Analogy
 
Salesforce CPQ Online Training
Prasannakumar898
 
Salesforce CPQ
Jade Global
 
Salesforce PPT.pptx
ShaikAllabakshu5
 

Viewers also liked (20)

PDF
Lightning Connect Custom Adapters: Connecting Anything with Salesforce
Salesforce Developers
 
PPTX
Access External Data in Real-time with Lightning Connect
Salesforce Developers
 
PDF
Lightning Connect: Lessons Learned
Salesforce Developers
 
PPTX
Lightning strikes twice- SEDreamin
Mohith Shrivastava
 
PDF
Lightning Out: Components for the Rest of the World
Salesforce Developers
 
PDF
Introduction to External Objects and the OData Connector
Salesforce Developers
 
PPT
TibcoSpotfire@VGSoM
Nilesh Kumar
 
PDF
Real-time SQL Access to Your Salesforce.com Data Using Progress Data Direct
Salesforce Developers
 
PPTX
Introduction to Analytics Cloud
Mohith Shrivastava
 
PDF
Apex Connector for Lightning Connect: Make Anything a Salesforce Object
Salesforce Developers
 
PPTX
Force.com Canvas in the Publisher and Chatter Feed
Salesforce Developers
 
PPTX
Go Faster with Process Builder
andyinthecloud
 
PPTX
TIBCO Advanced Analytics Meetup (TAAM) November 2015
Bipin Singh
 
PPT
Spotfire Integration & Dynamic Output creation
Ambareesh Kulkarni
 
PPTX
Building strong foundations apex enterprise patterns
andyinthecloud
 
PPTX
Salesforce World Tour 2016 : Lightning Out : Components on any Platform
andyinthecloud
 
PPSX
TIBCO Spotfire
Varun Varghese
 
PPT
Advanced Use of Properties and Scripts in TIBCO Spotfire
Herwig Van Marck
 
PPT
Getting the most out of Tibco Spotfire
Herwig Van Marck
 
Lightning Connect Custom Adapters: Connecting Anything with Salesforce
Salesforce Developers
 
Access External Data in Real-time with Lightning Connect
Salesforce Developers
 
Lightning Connect: Lessons Learned
Salesforce Developers
 
Lightning strikes twice- SEDreamin
Mohith Shrivastava
 
Lightning Out: Components for the Rest of the World
Salesforce Developers
 
Introduction to External Objects and the OData Connector
Salesforce Developers
 
TibcoSpotfire@VGSoM
Nilesh Kumar
 
Real-time SQL Access to Your Salesforce.com Data Using Progress Data Direct
Salesforce Developers
 
Introduction to Analytics Cloud
Mohith Shrivastava
 
Apex Connector for Lightning Connect: Make Anything a Salesforce Object
Salesforce Developers
 
Force.com Canvas in the Publisher and Chatter Feed
Salesforce Developers
 
Go Faster with Process Builder
andyinthecloud
 
TIBCO Advanced Analytics Meetup (TAAM) November 2015
Bipin Singh
 
Spotfire Integration & Dynamic Output creation
Ambareesh Kulkarni
 
Building strong foundations apex enterprise patterns
andyinthecloud
 
Salesforce World Tour 2016 : Lightning Out : Components on any Platform
andyinthecloud
 
TIBCO Spotfire
Varun Varghese
 
Advanced Use of Properties and Scripts in TIBCO Spotfire
Herwig Van Marck
 
Getting the most out of Tibco Spotfire
Herwig Van Marck
 
Ad

Similar to Two-Way Integration with Writable External Objects (20)

PPT
Salesforce1 Platform for programmers
Salesforce Developers
 
PPTX
Ladies Be Architects - Integration - Multi-Org, Security, JSON, Backup & Restore
gemziebeth
 
PDF
Easy No-Code Integrations with External Services and Visual Flow
Salesforce Developers
 
PPTX
Force.com Friday : Intro to Apex
Salesforce Developers
 
PDF
Force.com Friday: Intro to Force.com
Salesforce Developers
 
PPTX
Elevate Tel Aviv
sready
 
PPTX
[MBF2] Plate-forme Salesforce par Peter Chittum
BeMyApp
 
PPTX
Intro to Apex - Salesforce Force Friday Webinar
Abhinav Gupta
 
PPTX
Secure Development on the Salesforce Platform - Part I
Salesforce Developers
 
PPTX
Building Applications on the Salesforce1 Platform for Imperial College London
Peter Chittum
 
PDF
Unlock SAP - Release the potential of your existing backend systems with Sale...
Salesforce Deutschland
 
PDF
Mbf2 salesforce webinar 2
BeMyApp
 
PPTX
Javascript and Remote Objects on Force.com Winter 15
Peter Chittum
 
PPTX
Integration with the Salesforce App Cloud - Amsterdam 2016
Samuel De Rycke
 
PPTX
JDF18 - Connecting the customer success platform
Deepu Chacko
 
PPTX
Adopting Salesforce DX
Salesforce Developers
 
PDF
Salesforce API Series: Integrating Applications with Force.com Webinar
Salesforce Developers
 
PPTX
Deep Dive into Salesforce Integrations: Mapping Engines
CRMScienceKirk
 
PPTX
Salesforce Campus Tour - Developer Intro
James Ward
 
PDF
Intro to Apex Programmers
Salesforce Developers
 
Salesforce1 Platform for programmers
Salesforce Developers
 
Ladies Be Architects - Integration - Multi-Org, Security, JSON, Backup & Restore
gemziebeth
 
Easy No-Code Integrations with External Services and Visual Flow
Salesforce Developers
 
Force.com Friday : Intro to Apex
Salesforce Developers
 
Force.com Friday: Intro to Force.com
Salesforce Developers
 
Elevate Tel Aviv
sready
 
[MBF2] Plate-forme Salesforce par Peter Chittum
BeMyApp
 
Intro to Apex - Salesforce Force Friday Webinar
Abhinav Gupta
 
Secure Development on the Salesforce Platform - Part I
Salesforce Developers
 
Building Applications on the Salesforce1 Platform for Imperial College London
Peter Chittum
 
Unlock SAP - Release the potential of your existing backend systems with Sale...
Salesforce Deutschland
 
Mbf2 salesforce webinar 2
BeMyApp
 
Javascript and Remote Objects on Force.com Winter 15
Peter Chittum
 
Integration with the Salesforce App Cloud - Amsterdam 2016
Samuel De Rycke
 
JDF18 - Connecting the customer success platform
Deepu Chacko
 
Adopting Salesforce DX
Salesforce Developers
 
Salesforce API Series: Integrating Applications with Force.com Webinar
Salesforce Developers
 
Deep Dive into Salesforce Integrations: Mapping Engines
CRMScienceKirk
 
Salesforce Campus Tour - Developer Intro
James Ward
 
Intro to Apex Programmers
Salesforce Developers
 
Ad

More from Salesforce Developers (20)

PDF
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Salesforce Developers
 
PDF
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Salesforce Developers
 
PDF
Local development with Open Source Base Components
Salesforce Developers
 
PPTX
TrailheaDX India : Developer Highlights
Salesforce Developers
 
PDF
Why developers shouldn’t miss TrailheaDX India
Salesforce Developers
 
PPTX
CodeLive: Build Lightning Web Components faster with Local Development
Salesforce Developers
 
PPTX
CodeLive: Converting Aura Components to Lightning Web Components
Salesforce Developers
 
PPTX
Enterprise-grade UI with open source Lightning Web Components
Salesforce Developers
 
PPTX
TrailheaDX and Summer '19: Developer Highlights
Salesforce Developers
 
PDF
Live coding with LWC
Salesforce Developers
 
PDF
Lightning web components - Episode 4 : Security and Testing
Salesforce Developers
 
PDF
LWC Episode 3- Component Communication and Aura Interoperability
Salesforce Developers
 
PDF
Lightning web components episode 2- work with salesforce data
Salesforce Developers
 
PDF
Lightning web components - Episode 1 - An Introduction
Salesforce Developers
 
PDF
Migrating CPQ to Advanced Calculator and JSQCP
Salesforce Developers
 
PDF
Scale with Large Data Volumes and Big Objects in Salesforce
Salesforce Developers
 
PDF
Replicate Salesforce Data in Real Time with Change Data Capture
Salesforce Developers
 
PDF
Modern Development with Salesforce DX
Salesforce Developers
 
PDF
Get Into Lightning Flow Development
Salesforce Developers
 
PDF
Integrate CMS Content Into Lightning Communities with CMS Connect
Salesforce Developers
 
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Salesforce Developers
 
Local development with Open Source Base Components
Salesforce Developers
 
TrailheaDX India : Developer Highlights
Salesforce Developers
 
Why developers shouldn’t miss TrailheaDX India
Salesforce Developers
 
CodeLive: Build Lightning Web Components faster with Local Development
Salesforce Developers
 
CodeLive: Converting Aura Components to Lightning Web Components
Salesforce Developers
 
Enterprise-grade UI with open source Lightning Web Components
Salesforce Developers
 
TrailheaDX and Summer '19: Developer Highlights
Salesforce Developers
 
Live coding with LWC
Salesforce Developers
 
Lightning web components - Episode 4 : Security and Testing
Salesforce Developers
 
LWC Episode 3- Component Communication and Aura Interoperability
Salesforce Developers
 
Lightning web components episode 2- work with salesforce data
Salesforce Developers
 
Lightning web components - Episode 1 - An Introduction
Salesforce Developers
 
Migrating CPQ to Advanced Calculator and JSQCP
Salesforce Developers
 
Scale with Large Data Volumes and Big Objects in Salesforce
Salesforce Developers
 
Replicate Salesforce Data in Real Time with Change Data Capture
Salesforce Developers
 
Modern Development with Salesforce DX
Salesforce Developers
 
Get Into Lightning Flow Development
Salesforce Developers
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Salesforce Developers
 

Recently uploaded (20)

PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 

Two-Way Integration with Writable External Objects

  • 1. Two-Way Integration with Writable External Objects ​ Alexey Syomichev ​ Architect ​ [email protected] ​ @syomichev ​ 
  • 2. ​ Safe harbor statement under the Private Securities Litigation Reform Act of 1995: ​ This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward- looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. ​ The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. ​ Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements. Safe Harbor
  • 3. ​ Extract-Transform-Load (ETL) approach to data integration does not always work: §  Has to be driven by an ETL system; §  Synchronized dataset goes stale immediately; ​  External Objects allow data integration without physically moving the data: §  Back-office data is always up to date; §  Now includes write access! External Objects ​ Data Federation on Salesforce Platform
  • 4. 1.  Example of integration architecture 2.  External Data Source configuration 3.  Editing external objects 4.  Writing to external objects via API 5.  Writing to external object in Apex 6.  Questions Session outline
  • 6. ​ Throughout this session we will be exploring an example integration consisting of: §  Account data maintained in Salesforce; §  Order data maintained in back-office system; §  Relationship is by a business key Data Integration Example
  • 8. ​ Enable external writes using a new checkbox in data source parameters. ​ To be configured as writable, an OData service must support additional HTTP verbs: §  POST §  PUT §  MERGE/PATCH §  DELETE Configuration
  • 9. Create, Edit, Delete Making changes in external data via UI
  • 10. §  Standard UI for Edit, Create, Delete §  Remote save is requested immediately §  Any remote failure manifests as a user-visible error Editing external objects
  • 11. §  Create, Edit and Delete also supported in mobile UI Mobile editing
  • 12. API Saving or deleting external data via sObject API
  • 13. §  Workbench §  SOAP API §  REST API Multi-object save has to be homogeneous: §  Transaction boundaries §  “AllOrNothing” semantics External writes with API
  • 14. Apex Building complex data modification scenarios
  • 15. ​ Apex allows to build logic that involves multiple related data modifications. §  Local changes are added to the transaction and are committed together at the end of Apex context. §  Remote changes are not tied to the transaction, and cannot be requested immediately while there is a local transaction open. ​ Account acct = new Account(name = “SAP”); ​ insert acct; ​ Opportunity oppt = new Opportunity(account = acct); ​ insert oppt; ​ SalesOrder__x order = new SalesOrder__x(); ​ order.account = acct; ​ insert order; Complex scenarios
  • 16. No distributed transactions or two-phase commit: §  Salesforce core database has ACID properties: §  Atomic §  Consistent §  Isolated §  Durable §  External writes follow BASE semantics: §  Basically available §  Soft state §  Eventually consistent Transactional Semantics
  • 17. In class System.Database there are new operations exclusively for external objects: -  For insert, update and delete; -  Of “immediate” and “async” behavior; -  Async operations come with or without callback option External CRUD operations   Database.insertImmediate(obj);     Database.insertAsync(obj);     Database.insertAsync(obj,  cb);     Database.updateImmediate(obj);     Database.updateAsync(obj);     Database.updateAsync(obj,  cb);     Database.deleteImmediate(obj);     Database.deleteAsync(obj);     Database.deleteAsync(obj,  cb);  
  • 18. Database.insertAsync() ​ public void createOrder() { ​  SalesOrder__x order = new SalesOrder__x(); ​  Database.SaveResult sr = Database.insertAsync(order); ​  if (!sr.isSuccess()) { ​  String locator = Database.getAsyncLocator(sr); ​  completeOrderCreation(locator); ​  } ​ } ​ @future ​ public void completeOrderCreation(String locator) { ​  SaveResult sr = Database.getAsyncResult(locator); ​  if (sr.isSuccess()) { ​  System.debug(“sales order has been created”); ​  } ​ }
  • 19. Asynchronous callback ​ global class SaveCallback extends DataSource.AsyncSaveCallback { ​  override global void processSave(Database.SaveResult sr) { ​  if (sr.isSuccess()) { ​  System.debug("Save complete: Id = " + st.getId()); ​  } ​  } ​ } public void createOrder() { ​  SalesOrder__x order = new SalesOrder__x(); ​  SaveCallback callback = new SaveCallback(); ​  Database.updateAsync(order, callback); ​ }
  • 20. ​ Asynchronous external writes follow the eventual consistency model with BASE semantics, as opposed to ACID semantics of Salesforce core DB: §  Reads performed shortly after writes may not reflect the changes §  Writes will eventually reach the remote system §  Even when Salesforce is the only writing system, remote data may change over time without current input: as queued up changes flow out, repeated reads may return different results §  There is no ordering guarantees between writes issued from unrelated contexts §  Conflict resolution strategy is up to the remote system, but in most naive configuration the latest change to be applied wins §  Coordinated changes can be orchestrated with compensating transactions Consistency Model – Design Considerations
  • 21. ​ Asynchronous writes can be tracked by org admin in the BackgroundOperation sObject: Monitoring SELECT Id, Status, CreatedDate, StartedAt, FinishedAt, RetryCount, Error FROM BackgroundOperation WHERE Name = 'SalesOrder__x upsert' ORDER BY CreatedDate DESC
  • 22. §  External writes are synchronous when performed via API or UI §  API save cannot mix external and regular objects §  Apex code can perform external writes only via Database.insertAsync() et al. §  Database.insertAsync() is separate to avoid confusion with transactional insert() §  Asynchronous writes offer eventual consistency model §  Apex code cannot use insert()/update()/create() on external objects §  Apex code can supply callbacks for compensating actions §  Admin can monitor background write via API/SOQL §  Available in Winter’16 Summary
  • 23. Share Your Feedback, and Win a GoPro! 3 Earn a GoPro prize entry for each completed survey Tap the bell to take a survey2Enroll in a session1