您位於此處:
包含動態選項的問題:範例 Apex 類別
若要在您的增強型機器人中使用包含動態選項的問題,請建立自動啟動 Apex 類別,以填入您指定的物件和欄位中的選項。Apex 類別必須傳回識別碼清單變數,作為用於機器人的輸出。。
若要在您的增強型機器人中使用包含動態選項的問題,請建立自動啟動 Apex 類別,以填入您指定的物件和欄位中的選項。Apex 類別必須傳回識別碼清單變數,作為用於機器人的輸出。。
| 檢視 Einstein 機器人的支援版本。 |
| 針對「傳訊」檢視支援的版本。 |
此 Apex 類別會搜尋個案,並依優先順序篩選。該類別會傳回最近三個高優先順序的個案,並儲存在識別碼清單中。
public class CaseSearch {
@InvocableMethod(label = 'CaseSearch')
public static List<List<Id>> getCases(){
List<Id> result = new List<Id>();
List<Case> cases = [SELECT Id FROM Case WHERE Priority='High' ORDER BY CreatedDate DESC LIMIT 3];
for(Case c: cases) {
result.add(c.Id);
}
return new List<List<Id>>{result};
}
}
建立 Apex 類別之後,在機器人中新增參照 Apex 類別的「Apex 類別」動作對話步驟,並將輸出儲存在識別碼清單機器人變數中。在相關聯的「問題」(動態) 對話步驟中,參照「記錄識別碼選項」輸入參數中識別碼相同的清單機器人變數。

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.