Sample code for the Case list component
reference brazil Updated Sep 10, 2026 1 min read we-case-list-sample-code.md
Use this sample code to run an action when the Case list component triggers an event.
Sample code
Update the sample code for your use case before embedding the component on your webpage.
JavaScript
{
'SN_EMBEDX_CASE_LIST#RECORD_SELECTED' : (e) => {
// This event is dispatched when a record is selected.
var {table, record_sys_id} = e.detail.payload;
// the logic to construct the URL for the Case View component. Add your portal URL here.
const caseViewURL = '/caseview?emb_table='+table+'&emb_recordid='+record_sys_id;
// Redirect to the Case view component page
open(caseViewURL,'_self');
},
'SN_EMBEDX_CASE_LIST#COMPONENT_READY' : (e) => {
// This event is dispatched when a component is ready and usable.
},
'SN_EMBEDX_CASE_LIST#COMPONENT_ERROR' : (e) => {
// This event is dispatched when a property validation or internal error occurs.
var {errorMessage, errorType} = e.detail.payload;
console.log(errorMessage, errorType);
}Related topics
Configure the Case list component instance
Embed the Case list component instance on the third-party website
70 lines · 2.5 KB
---
title: Sample code for the Case list component
description: Use this sample code to run an action when the Case list component triggers an event.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/customer-service-management/customer-self-service-and-omnichannel-engagement/we-case-list-sample-code.html
release: brazil
product: Customer Self-service and Omnichannel Engagement
classification: customer-self-service-and-omnichannel-engagement
topic_type: reference
last_updated: "2026-09-10"
reading_time_minutes: 1
breadcrumb: [Case list component, Configure web components, Configure Web Embeddables, Set up self-service, Configure, Customer Service Management]
---
# Sample code for the Case list component
Use this sample code to run an action when the Case list component triggers an event.
## Sample code
Update the sample code for your use case before embedding the component on your webpage.
```
{
'SN_EMBEDX_CASE_LIST#RECORD_SELECTED' : (e) => {
// This event is dispatched when a record is selected.
var {table, record_sys_id} = e.detail.payload;
// the logic to construct the URL for the Case View component. Add your portal URL here.
const caseViewURL = '/caseview?emb_table='+table+'&emb_recordid='+record_sys_id;
// Redirect to the Case view component page
open(caseViewURL,'_self');
},
'SN_EMBEDX_CASE_LIST#COMPONENT_READY' : (e) => {
// This event is dispatched when a component is ready and usable.
},
'SN_EMBEDX_CASE_LIST#COMPONENT_ERROR' : (e) => {
// This event is dispatched when a property validation or internal error occurs.
var {errorMessage, errorType} = e.detail.payload;
console.log(errorMessage, errorType);
}
```
**Related topics**
[Configure the Case list component instance](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/customer-service-management/customer-self-service-and-omnichannel-engagement/configure-case-list-component-on-instance.md)
[Embed the Case list component instance on the third-party website](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/customer-service-management/customer-self-service-and-omnichannel-engagement/embed-case-list-component-on-third-party-website.md)
[Component properties for the Case list](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/customer-service-management/component-properties-for-the-case-list.md)
[Event handler in the Case list component](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/customer-service-management/we-case-list-event-handlers.md)
| title | Sample code for the Case list component |
| description | Use this sample code to run an action when the Case list component triggers an event. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/customer-service-management/customer-self-service-and-omnichannel-engagement/we-case-list-sample-code.html |
| release | brazil |
| product | Customer Self-service and Omnichannel Engagement |
| classification | customer-self-service-and-omnichannel-engagement |
| topic_type | reference |
| last_updated | 2026-09-10 |
| reading_time_minutes | 1 |
| breadcrumb | Case list componentConfigure web componentsConfigure Web EmbeddablesSet up self-serviceConfigureCustomer Service Management |