Contact Us

February 2, 2025

June 23, 2026 2:02 pm

Accessing Apex Classes in Flex Prompt Builder

Share with

Understanding the Issue

The Flex Prompt Builder is designed to work with prompt flows, which are a series of steps that define how a prompt is generated and processed. To use an Apex class in the Flex Prompt Builder, it must be invoked as part of a prompt flow.

This requirement is due to how Agentforce manages the execution of Apex code and the flow of data through the system. By invoking the Apex class within a prompt flow, you can ensure that the class is executed in the correct context and with the necessary permissions.

Root Cause of the Issue

The root cause of this issue is the lack of a prompt flow to invoke the Apex class. Without a prompt flow, the Flex Prompt Builder does not have a context in which to execute the Apex class, resulting in the class not being visible or accessible.

Step-by-Step Solution

To resolve this issue, follow these steps:

ApexClassInvocation.txt

1. Create a new prompt flow in the Flex Prompt Builder.
2. Add a step to the prompt flow that invokes the Apex class.
3. Configure the Apex class invocation to pass any necessary parameters or data.
4. Save and deploy the prompt flow.

By following these steps, you can ensure that your Apex class is properly invoked within a prompt flow and accessible in the Flex Prompt Builder.

Best Practices and Troubleshooting

Heads up: Make sure to test your prompt flow and Apex class invocation thoroughly to ensure that they are working as expected.

In addition to the steps outlined above, here are some best practices and troubleshooting tips to keep in mind:

Checklist for Troubleshooting Apex Class Issues

  • Verify that the Apex class is properly configured and deployed in the org.
  • Check that the user profile has the necessary permissions to access the Apex class.
  • Ensure that the prompt flow is correctly configured to invoke the Apex class.
  • Test the prompt flow and Apex class invocation in a non-production environment before deploying to production.
  • Monitor the Apex class and prompt flow for any errors or issues that may arise.

By following these best practices and troubleshooting tips, you can help ensure that your Apex classes are properly integrated with the Flex Prompt Builder and functioning as expected.

Frequently Asked Questions

What is the purpose of a prompt flow in Agentforce?

A prompt flow is a series of steps that define how a prompt is generated and processed in Agentforce.

How do I invoke an Apex class in a prompt flow?

You can invoke an Apex class in a prompt flow by adding a step to the flow that calls the Apex class.

What permissions are required to access an Apex class in Agentforce?

The user profile must have the necessary permissions to access the Apex class, including the ability to execute the class and access any necessary data.

How do I troubleshoot issues with Apex class invocation in Agentforce?

You can troubleshoot issues with Apex class invocation by checking the prompt flow configuration, verifying that the Apex class is properly configured and deployed, and monitoring the Apex class and prompt flow for any errors or issues.

Genetrix Technology · Salesforce Marketing Cloud Partner

Need help shipping this in production?

Genetrix builds and untangles Salesforce Marketing Cloud and Agentforce setups for teams that want it done right the first time. If anything in this post sounds familiar, talk to us before it ships.

Get in Touch with Genetrix →

Blogs for the

Business-Savvy!​

Let’s Connect

A 30 min no cost strategy session
with cloud support expert

Let’s Connect

A 30 min no cost strategy session
with cloud support expert