Salesforce Integration 概覽(七) Data Virtualization資料視覺化

zero.zhang發表於2021-08-13

本篇參考:https://resources.docs.salesforce.com/sfdc/pdf/integration_patterns_and_practices.pdf

Salesforce實時訪問外部資料。這樣就不需要在Salesforce中儲存資料,然後在Salesforce和外部系統之間協調資料。

一.上下文

您可以使用Salesforce跟蹤銷售線索、管理銷售渠道、建立銷售機會,並捕獲將銷售線索轉換為客戶的訂單詳細資訊。然而,Salesforce不是包含或處理訂單的系統。訂單由外部(遠端)系統管理。但是銷售代表希望在Salesforce中檢視和更新實時訂單資訊,而不必學習和使用外部系統。

二. 問題和考慮因素

 問題: 在Salesforce中,如何檢視、搜尋和修改儲存在Salesforce外部的資料,而不將資料從外部系統移動到Salesforce中?

考慮因素:當基於這種模式應用解決方案時,需要考慮各種各樣的因素:

•是否要在Salesforce中構建宣告式/點選式出站整合或UI mashup?

•是否有大量資料並且不想複製到Salesforce組織中?

•是否需要同時訪問少量遠端系統資料?

•是否需要實時訪問最新資料?

•是否將資料儲存在雲端或後臺系統中,但希望在Salesforce組織中顯示或處理這些資料?

•在Salesforce中儲存某些型別的資料時,您是否有資料駐留問題?

三. 解決方案

解決方案

適配程度

介紹

Salesforce Connect

Best

使用Salesforce Connect訪問來自外部源的資料以及Salesforce資料。實時從傳統系統(如SAP、Microsoft和Oracle)中提取資料,而無需在Salesforce中複製資料。Salesforce Connect將外部系統中的資料表對映到組織中的外部物件。外部物件與自定義物件類似,只是它們對映到Salesforce組織外部的資料。Salesforce Connect使用到外部資料的實時連線來始終保持外部物件的最新狀態。

 

訪問外部物件從外部系統實時獲取資料。Salesforce Connect允許您:

 

•查詢外部系統中的資料。

•在外部系統中建立、更新和刪除資料。

•通過列表檢視、詳細資訊頁、記錄提要、自定義選項卡和頁面佈局訪問外部物件。

•定義外部物件與標準或自定義物件之間的關係,以整合不同來源的資料。

•在外部物件頁面上啟用Chatter提要以進行協作。

•對外部資料執行報告(有限)。

•檢視Salesforce移動應用程式上的資料。

要使用Salesforce Connect訪問儲存在外部系統上的資料,可以使用以下介面卡之一:

•OData 2.0介面卡或OData 4.0介面卡-連線到任何OData 2.0或4.0生產商公開的資料。

•跨組織介面卡-連線到儲存在另一個Salesforce組織中的資料。跨組織介面卡使用標準的Lightning Platform REST API。與OData不同,跨組織介面卡直接連線到另一個組織,而不需要中間web服務。

•通過Apex建立的自定義介面卡-如果OData和跨組織介面卡不適合您的需要,請使用Apex聯結器框架開發您自己的介面卡。

也可以參考:

salesforce零基礎學習(九十八)Salesforce Connect & External Object

Request and Reply

Suboptimal

使用Salesforce web服務API發出特殊資料請求以訪問和更新外部系統資料。此解決方案包括以下方法:

 

使用Salesforce SOAP API。自定義Visualforce頁面或按鈕以同步方式啟動Apex SOAP呼叫。在Salesforce中,您可以使用WSDL並生成最終的代理Apex類。此類提供呼叫遠端服務所需的邏輯。Visualforce頁上使用者啟動的操作然後呼叫Apex控制器操作,該操作執行此代理Apex類以執行遠端呼叫。Visualforce頁面需要定製Salesforce應用程式。

 

使用Salesforce REST API。自定義Visualforce頁面或按鈕以同步方式啟動Apex HTTP呼叫(REST服務)。在Salesforce中,可以使用標準的GET、POST、PUT和DELETE方法呼叫HTTP服務。可以使用幾個HTTP類與RESTful服務整合。Visualforce頁上使用者啟動的操作然後呼叫Apex控制器操作,該操作執行這些代理Apex類以執行遠端呼叫。Visualforce頁面需要定製Salesforce應用程式。

 

這種操作適用於特殊場景,需要過濾或者需要做資料的格式轉換等操作,之所以次優因為需要有溝通、開發以及聯調的工作,耗時長,穩定性取決於程式碼質量等等。

四. 流程草圖

在這種情況下:

1.瀏覽器執行一個AJAX呼叫,該呼叫依次對相應的外部物件介面卡執行一個操作。

 2.介面卡將操作轉換為OData請求,並通過整合層和服務層向遠端系統發出HTTP GET請求。

 3.遠端系統通過整合層和服務層向Salesforce返回JSON響應。

 4.將響應從OData轉換為外部物件並呈現回瀏覽器。

五. 其他關鍵點

呼叫機制

描述

External Objects

Salesforce Connect將Salesforce外部物件對映到外部系統中的資料表。Salesforce Connect不是將資料複製到組織中,而是按需實時訪問資料。即使資料儲存在組織外部,Salesforce Connect也能與Lightning平臺無縫整合。Salesforce工具可以使用外部物件,例如全域性搜尋、查詢關係、記錄源和Salesforce移動應用程式。外部物件也可用於Apex、SOSL、SOQL查詢、salesforceapi,以及通過後設資料API、變更集和包進行部署。

Lighting Components or

Visualforce Pages

當遠端程式作為涉及使用者介面的端到端程式的一部分觸發時使用,並且結果必須在Salesforce記錄中顯示或更新。例如,向外部支付閘道器提交信用卡支付並立即返回顯示給使用者的支付結果的過程。由使用者介面事件觸發的整合通常需要建立自定義Lightning元件或Visualforce頁面。

六. 常見考題

 Given the diagram below, a Salesforce org, middleware, and Historical data store (with 20milIion records and growing) exists with connectivity between them.

 Historical records are archived from Salesforce and moved to Historical Data store (which houses 20M records and growing; fine tuned to be performant with search queries). Call center agents use Salesforce, when reviewing occasional special cases, have requested access to view the related historical case items that relate to submitted cases. Which mechanism and patterns are recommended to maximize declarative configuration?

Use ESB tool with Data Virtualization pattern, expose OData endpoint, and then use Salesforce Connect to consume and display the External Object along side with the Case object.

Universal Containers (UC) wants to connect their on-premise ERP system to view Order data in Salesforce. UC is considering a solution to integrate the on-premise system using Salesforce Connect via OData. Which three considerations should an Architect keep in mind when recommending use of Salesforce Connect?  Salesforce Connect的優點

Customer wants the ability to query external data using Global Search and reports.

Customer needs to query small amounts of data at any time and display using a related list.

Customer has a large amount of data that they do not want to load into Salesforce.

 Customer does not want real-time access to the ERP data and is willing to wait for hourly refreshes.

Customer wants to create a master-detail relationship between Opportunity and the external object.

總結:此種場景針對大資料不能落在SF並且滿足需要檢視等的需求,還是很好的解決方案。至此所有的整合模式都已經描述完。篇中有錯誤歡迎指出,有不懂歡迎留言。

相關文章