Sample code for the Object list component

reference brazil Updated Sep 10, 2026 1 min read we-object-list-sample-code.md
Raw file servicenow.com

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. 
} }
Search documentation
Search document titles and file paths on the brazil branch