Loading
Upcoming Mandatory Changes to Public Key Infrastructure (PKI)Read More
Agentforce and Einstein Generative AI
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create Variables in Agentforce Builder

          Create Variables in Agentforce Builder

          Use variables to store and reuse values in your agent’s reasoning and control how an agent makes decisions. For example, when you assign a variable to an action input, your agent can use only the assigned variable to fill the value of the input.

          Required Editions

          Available in: Lightning Experience
          Available in: Enterprise, Performance, Unlimited, and Developer Editions. Required add-on licenses vary by agent type.
          User Permissions Needed
          To create a variable: Manage AI Agents AND the required permissions for your agent type
          1. From the App Launcher, enter Agent, and then select the Agentforce Studio app.
          2. On the Agents tab, click the name of your agent.
          3. On the Explorer panel, click Variables.
          4. On the Variables page, click New.
            1. To create a custom variable, click Create Custom Variable. In the New Variable window, define the variable's settings. By default, variables can only be set in the agent. To set the value of a variable with an API, select Enable API write access.
            2. To add a context variable that's mapped to a Messaging Session object field, click Add Messaging Session Variable. Select the variables that you want to add and then click Add to Agent.

          To create a variable that's set to an action output, select an action in the Actions Available For Reasoning section of a subagent. Next to an action output, click Select Variable and then select Create a variable. In the New Variable window, define the variable's settings.

          By default, action inputs are agent populated. To assign a specific variable to an action input, select an action in the Actions Available For Reasoning section of a subagent. Then, next to an action input, click Select Variable.

          To use a variable in subagent instructions, use this format in natural language prompts: {!@variables.VariableName}. And use this format in logical expressions: @variables.VariableName.

           
          Loading
          Salesforce Help | Article