Skip to content

Instantly share code, notes, and snippets.

@tyoshikawa1106
Created December 30, 2025 22:59
Show Gist options
  • Select an option

  • Save tyoshikawa1106/fa2c6381ff9357a7091706434a330689 to your computer and use it in GitHub Desktop.

Select an option

Save tyoshikawa1106/fa2c6381ff9357a7091706434a330689 to your computer and use it in GitHub Desktop.
Agentforceプロンプトビルダー差し込み用Apexクラスのサンプルコード
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment