この記事では Apex ラッパークラスを利用して、ボットの会話でエンドユーザーが選択した [Article Answer] (記事の回答) を保存する方法について説明しています。
回答選択済みの結果オブジェクトの構造が異なるため、これを Apex クラスに渡して Knowledge__kav オブジェクトにマッピングすることはできません。
回答選択済みの結果オブジェクトの構造は次のとおりです。
{
"question": "abc",
"answer": "test",
"confidence":0.817549,
"id": "kaQ1q0000008OJXEA2",
"title": "test",
"type":"FAQ"
}
以下は、オブジェクトの作成と選択済みの変数を Apex クラスに渡す処理を説明する例です。
クラスの例を作成します。
public class objectArt {
public string question;
public string answer;
public double confidence;
public string id;
public string title;
public string type;
}
次に、このオブジェクトを、呼び出し可能な変数の例で使用します。
public class Requests {
@InvocableVariable(label='Records for Input' description='yourDescription' required=true)
public objectArt article;
}
これで、回答選択済みの結果オブジェクトが正常にマッピングされ、選択したナレッジ の ID にアクセスできるようになります。
呼び出し可能なメソッドは、次の例のように、この呼び出し可能な変数を入力として受け入れます。
@InvocableMethod(label='Get article')
public static List<Results> getSkillId(List<Requests> sobj) {....}
関連する以下のヘルプ記事を確認してください。
Einstein ボットのシステム制限 (Apex アクション時間制限 - 10 秒)
003789771

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.