AgentForce Not Fetching Total Opportunity Count for 2025 in Salesforce - Stack Overflow

I am trying to build an AgentForce agent that retrieves the total opportunity count for the year 2025 u

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
Add a comment  | 

1 Answer 1

Reset to default 0

Check these key areas to fix your issue:

  1. 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};
    }
    
  2. Flow Setup – Verify input (2025) is correctly passed and output is mapped.

  3. Debug Flow – Add a Screen Element or log the output to check values.

  4. AgentForce Response – Ensure it properly handles and displays numeric responses.

  5. 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信