--- title: Add custom context to the Hosted Insight Panel slug: o28a0498 canonical_url: https://docs.coveo.com/en/o28a0498/ collection: coveo-for-salesforce source_format: adoc --- # Add custom context to the Hosted Insight Panel > **Available since** > > This feature was introduced in the February 2024 release of Coveo for Salesforce version [5.6](https://docs.coveo.com/en/n5bj0150#february-2024-release-v5-6-minor-release). To add [custom context](https://docs.coveo.com/en/3389/) to the Hosted Insight Panel, you must create a custom Apex class that implements the `CoveoV2.HostedCustomContextInterface` as described in this article. To add custom context . [Create an Apex class](https://help.salesforce.com/s/articleView?id=sf.code_manage_packages.htm&type=5) that implements the `CoveoV2.HostedCustomContextInterface` as follows: **Example** ```java global class MyCustomContext implements CoveoV2.HostedCustomContextInterface { public Map getCustomContext(Map data) { // Retrieves the record ID that's currently being accessed in the Hosted Insight Panel. String currentRecordId = (String)data.get('recordId'); // Returns the map of custom context values that will be added to each query. return new Map{'key1' => 'value1', 'recordId' => currentRecordId, 'listOfValues' => new List{'listValue1', 'listValue2'}}; } } ``` Where: * `key1` is the [context](https://docs.coveo.com/en/1345/) key/value pair to add to each [query](https://docs.coveo.com/en/231/). * `recordId` is the ID of the record that's currently being accessed in the Hosted Insight Panel. * `listOfValues` is the array of context values to add to each query. . Save the Apex class. ## What's next? Once you've created an Apex class that implements the `CoveoV2.HostedCustomContextInterface`, you'll be able to select it from the [**Custom Context Provider** picklist](https://docs.coveo.com/en/m7ed8015#customcontextprovider) in the **Coveo Hosted Insight Panel** component to augment queries with the additional context returned by your custom Apex class.