타사 데이터 통합 샘플 스크립트
원격 테이블 스크립트는 외부 공급업체 애플리케이션에서 기록을 끌어오도록 설계할 수 있습니다. 이 스크립트는 원격 테이블의 데이터에 액세스하기 위한 쿼리가 수행될 때 호출됩니다.
IntegrationHub와 함께 원격 테이블을 사용하려면 외부 공급업체 애플리케이션과 함께 작동하는 IntegrationHub 스포크를 식별해야 합니다. 이 스포크는 해당 애플리케이션에서 다양한 데이터 하위 집합을 가져오도록 생성된 Flow Designer 작업으로 구성됩니다.
예를 들어, Salesforce 애플리케이션에서 계정 정보를 가져와야 하는 경우에는 Salesforce 스포크 및 모든 계정 가져오기 작업을 사용해야 합니다. 이 작업에 액세스하는 원격 테이블 스크립트의 예시는 아래를 참조하십시오.
(function executeQuery(v_table, v_query) {
try {
// prepare inputs for the spoke actions
// Get All Accounts action does not have any inputs).
var inputs = {};
// call spoke action
var outputs = sn_fd.FlowAPI.executeAction(
"sn_salesforce_spok.get_all_accounts", inputs);
// check if Action was completed successfully
if (outputs.status != "Success") {
throw new Error(outputs.errorMessage);
}
// extract payload from the action outputs
var accounts = outputs.accounts.data;
// map action output data to the remote table columns and Sys Id
for (var i = 0; i < accounts.length; i++) {
v_table.addRow({
"u_sf_account_id": accounts[i].name,
"u_sf_account_name": accounts[i].label,
// assign remote table Sys Id to the primary key of the third-party
// record
"sys_id": accounts[i].name,
});
}
// process errors
} catch (error) {
gs.addErrorMessage("Error trying to retrieve Salesforce Accounts." +
"Please contact System Administrator.");
gs.addErrorMessage("System Error: " + error.message);
}
})(v_table, v_query);
주:
모든 IntegrationHub 동작을 원격 테이블 스크립트에서 호출할 수 있는 것은 아닙니다. 특히 데이터 스트림 작업은 스크립트에서 호출할 수 없습니다. 사용할 작업이 데이터 스트림 작업인 경우에는 REST 단계를 기반으로 사용자 고유의 작업을 만들어야 할 수도 있습니다. 작업을 만드는 쉬운 방법은 기존 작업을 복사한 다음 수정하여 목표를 달성하는 것입니다. 다음 주제에서 사용자 지정 스포크 작업의 예를 볼 수 있습니다. Salesforce 스포크 작업을 만들어 원격 테이블 정의에 사용할 기회 검색.