Sample code for the Object list component
reference australia Updated Mar 12, 2026 1 min read we-object-list-sample-code.md
Use this sample code to run an action when the Object list component triggers an event.
Sample code
Update the sample code for your use case before you embed the component on your webpage.
JavaScript
{
'SN_EMBEDX_OBJECT_LIST#FOOTER_LINK_SELECTED' : (e) => {
// This event is dispatched when footer link is selected
var {table, view, edit_query, nest_by} = e.detail.payload;
const objectListURL = '/objectlist?emb_table=' + table + '&emb_query=' + edit_query + '&emb_view=' + view + '&emb_nestby=' + nest_by;
// Open the Record List component in the same tab
open(objectListURL, '_self');
},
'SN_EMBEDX_OBJECT_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);
},
'SN_EMBEDX_OBJECT_LIST#RECORD_SELECTED' : (e) => {
// This event is dispatched when a record is selected.
var {table, record_sys_id} = e.detail.payload;
var RecordViewURL;
if(table == 'sn_customerservice_case'){
RecordViewURL = '/caseview?emb_table=' + table + '&emb_recordid=' + record_sys_id;
} else {
RecordViewURL = '/recordview?emb_table=' + table + '&emb_recordid=' + record_sys_id;
}
open(RecordViewURL, '_self');
},
'SN_EMBEDX_OBJECT_LIST#COMPONENT_READY' : (e) => {
// This event is dispatched when a component is ready and usable.
}81 lines · 2.1 KB
---
title: Sample code for the Object list component
description: Use this sample code to run an action when the Object list component triggers an event.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/australia/customer-service-management/customer-self-service-and-omnichannel-engagement/we-object-list-sample-code.html
release: australia
product: Customer Self-service and Omnichannel Engagement
classification: customer-self-service-and-omnichannel-engagement
topic_type: reference
last_updated: "2026-03-12"
reading_time_minutes: 1
breadcrumb: [Object list component, Configure web components, Configure Web Embeddables, Set up self-service, Configure, Customer Service Management]
---
# Sample code for the Object list component
Use this sample code to run an action when the Object list component triggers an event.
## Sample code
Update the sample code for your use case before you embed the component on your webpage.
```
{
'SN_EMBEDX_OBJECT_LIST#FOOTER_LINK_SELECTED' : (e) => {
// This event is dispatched when footer link is selected
var {table, view, edit_query, nest_by} = e.detail.payload;
const objectListURL = '/objectlist?emb_table=' + table + '&emb_query=' + edit_query + '&emb_view=' + view + '&emb_nestby=' + nest_by;
// Open the Record List component in the same tab
open(objectListURL, '_self');
},
'SN_EMBEDX_OBJECT_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);
},
'SN_EMBEDX_OBJECT_LIST#RECORD_SELECTED' : (e) => {
// This event is dispatched when a record is selected.
var {table, record_sys_id} = e.detail.payload;
var RecordViewURL;
if(table == 'sn_customerservice_case'){
RecordViewURL = '/caseview?emb_table=' + table + '&emb_recordid=' + record_sys_id;
} else {
RecordViewURL = '/recordview?emb_table=' + table + '&emb_recordid=' + record_sys_id;
}
open(RecordViewURL, '_self');
},
'SN_EMBEDX_OBJECT_LIST#COMPONENT_READY' : (e) => {
// This event is dispatched when a component is ready and usable.
}
```
| title | Sample code for the Object list component |
| description | Use this sample code to run an action when the Object list component triggers an event. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/australia/customer-service-management/customer-self-service-and-omnichannel-engagement/we-object-list-sample-code.html |
| release | australia |
| product | Customer Self-service and Omnichannel Engagement |
| classification | customer-self-service-and-omnichannel-engagement |
| topic_type | reference |
| last_updated | 2026-03-12 |
| reading_time_minutes | 1 |
| breadcrumb | Object list componentConfigure web componentsConfigure Web EmbeddablesSet up self-serviceConfigureCustomer Service Management |