Created
December 30, 2025 22:59
-
-
Save tyoshikawa1106/fa2c6381ff9357a7091706434a330689 to your computer and use it in GitHub Desktop.
Agentforceプロンプトビルダー差し込み用Apexクラスのサンプルコード
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public with sharing class PersonalizedGuestExperiences { | |
| // Make this method available for grounding | |
| // the Generate_Personalized_Schedule prompt template | |
| @InvocableMethod | |
| public static List<Response> getSessions(List<Request> requests) { | |
| Request input = requests[0]; | |
| Contact contact = input.myContact; | |
| List<Session__c> sessions = | |
| ExperienceSessionController.getSessions(contact); | |
| // Create expected response | |
| List<Response> responses = new List<Response>(); | |
| Response res = new Response(); | |
| res.prompt = JSON.serialize(sessions); | |
| responses.add(res); | |
| return responses; | |
| } | |
| // The variables in this class need to match the prompt template inputs, | |
| // that may be different on each prompt template | |
| public class Request { | |
| @InvocableVariable(required=true) | |
| public Contact myContact; | |
| } | |
| public class Response { | |
| @InvocableVariable | |
| public String Prompt; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trailhead
https://trailhead.salesforce.com/ja/content/learn/projects/customize-a-service-agent-with-prompts-flows-and-actions/get-agent-ready?trail_id=become-an-agentblazer-innovator