Configure Agentforce Context Variables

Map your custom fields as parameters in the Embedded Service Deployment to pass campaign data to the agent.

Required Editions

Available in: Salesforce Classic and Lightning Experience
Available in: Available in Enterprise, Performance, Unlimited, and Developer Editions with Foundations or Agentforce 1 Editions. Access to some standard agent actions requires additional add-on licenses.
Available in: LWR and Aura
Available in: Enhanced Chat with the Einstein for Service, Einstein Platform, Community, Community Plus, or Agentforce for Service add-on
Available in: Available in Enterprise, Performance, Unlimited, and Developer Editions with Foundations or Agentforce 1 Editions. Access to some standard agent actions requires additional add-on licenses.
User Permissions Needed
To build and manage Service agents: Manage Agentforce Service Agents AND Manage AI Agents OR Customize Application
To set up this feature: set up this feature: Customize Application AND Modify Metadata Through Metadata API Functions

Context variables act as a bridge between your CRM (Customer Relationship Management) data and the chat interface. Mapping these variables makes sure that when a proactive chat starts, the system automatically populates the session data required for the agent to function correctly.

  1. From Setup, in the Quick Find box, enter Messaging Settings, and select Messaging Settings.
  2. Click the name of the messaging channel you created for proactive service.
  3. Under Custom Parameters, click New.
  4. Create parameters for the Service Campaign ID, Service Campaign Member ID, and Service Agent prompt.
    For the best results, match the parameter name to the channel variable name.
  5. From Setup, in the Quick Find box, enter Embedded Service and select Embedded Service Deployments.
  6. Find your deployment and select View from the dropdown menu.
  7. Select Edit Pre-Chat and make sure that you activate the pre-chat feature.
  8. Under Hidden Pre-Chat Fields, select your custom parameters from the Available list and move them to the Selected list.
  9. Save your changes and click Publish on the deployment settings page.