I am trying to build an AgentForce agent that retrieves the total opportunity count for the year 2025 using an Invocable Apex Method. My goal is to:
Use AgentForce to process the user request: Example User Input: "Show me total opportunity count for 2025" Expected Output: "200" Ensure the result is correctly displayed in AgentForce responses.
I have created an AgentForce-powered Flow that retrieves the total opportunity amount for the year 2025 using an Invocable Apex Method. The input to the Flow is correct, but the output is not as expected when executed in AgentForce.
I am trying to build an AgentForce agent that retrieves the total opportunity count for the year 2025 using an Invocable Apex Method. My goal is to:
Use AgentForce to process the user request: Example User Input: "Show me total opportunity count for 2025" Expected Output: "200" Ensure the result is correctly displayed in AgentForce responses.
I have created an AgentForce-powered Flow that retrieves the total opportunity amount for the year 2025 using an Invocable Apex Method. The input to the Flow is correct, but the output is not as expected when executed in AgentForce.
Share asked Mar 11 at 8:13 Sk_DevSk_Dev 1 1- Please provide enough code so others can better understand or reproduce the problem. – Community Bot Commented Mar 11 at 13:09
1 Answer
Reset to default 0Check these key areas to fix your issue:
Apex Method – Ensure your Invocable method correctly counts opportunities for 2025:
@InvocableMethod public static List<Integer> getOpportunityCount(List<Integer> yearList) { Integer count = [SELECT COUNT() FROM Opportunity WHERE CALENDAR_YEAR(CloseDate) = :yearList[0]]; return new List<Integer>{count}; }
Flow Setup – Verify input (
2025
) is correctly passed and output is mapped.Debug Flow – Add a Screen Element or log the output to check values.
AgentForce Response – Ensure it properly handles and displays numeric responses.
Check Debug Logs – Look for SOQL errors or incorrect data mappings.
If issues persist, check the exact response format and Flow-Apex mappings.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744807634a4594875.html
评论列表(0条)