Context and conversation variables
Key Takeaway
Variables store an agent's state so it makes certain decisions the same way every time. To use a record field, such as a custom Messaging Session field, map a context variable to it. To reuse an action's output later, store the output in a custom variable.
Variables let an Agentforce agent store and reuse values, such as a customer's name or whether the customer is verified. With variables, the agent makes certain decisions the same way every time. Variables store the agent's current state across subagents and conversation turns. You use them in filters, instructions, and logical expressions to improve security, keep agent behavior consistent, and control how the agent makes decisions.
Types of variables
An agent works with three types of variables. Each type gets its value from a different place.
- Context variables, also called linked variables, are mapped to an object field.
- Custom variables, also called mutable variables, hold values set during the conversation.
- System variables are predefined and read-only, and they describe the current session.