To use the context variables passed by the Context Passing framework in your Agentforce Service agent, create custom fields on the Messaging Session object. These fields will store the data coming from your Experience Cloud site.
Required Editions
| Available in: Salesforce Classic and Lightning Experience |
| Available in: Aura and LWR Experience Cloud Sites |
| Available in: Enhanced Chat with the Einstein for Service, Einstein Platform, Community, Community Plus, or Agentforce Service Agent add-on |
| 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 |
Use these steps for each of the required context variables such as lastViewedArticleId or lastSearchQuery to create a corresponding custom field on the Messaging Session object.
- From Setup, in the Quick Find box, enter Object Manager, and then select Object Manager.
- On the Object Manager page, use the internal Quick Find box to search for Messaging Session, and then click Messaging Session to open its detail page.
- From the left menu, click Fields & Relationships.
- Click New.
- Select the Text field type, and then click Next.
- Set the field label and field name to exactly match the context variable name. For example, if the variable is lastSearchQuery, the API Name must be lastSearchQuery.
- Complete the remaining steps of the field creation wizard, setting appropriate Field-Level Security (FLS) and adding the field to necessary page layouts.
- To complete the wizard steps, set the correct Field-Level Security and add the field to the necessary page layouts for agents to view the data.
- Repeat steps 4 through 7 for every required context variable to make sure all data can be captured.