- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2022 12:34 AM
Hi all,
I have a question about the list component.
Is there a way that I could fetch the sysId's from records that got selected from the list? (see image)
Is this possible with a client script or a certain event?
Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Now Experience UI Framework
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2022 07:29 AM
Hi,
Here is how you can do it.
1. Your list component has an event named "Selected row count updated". This event is triggered whenever you select a record in row.
2. To see what is the data returned from an event, you can create a page script. Use below code to log the event payload to console.
console.log(JSON.stringify(event.payload));
I use this in every page I build to see what an event is returning.
3. In this payload you'll find the record sysId along with other useful data.
Mark my response correct if worked for you. 🙂
ServiceNow Community Rising Star 2022/2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2022 07:29 AM
Hi,
Here is how you can do it.
1. Your list component has an event named "Selected row count updated". This event is triggered whenever you select a record in row.
2. To see what is the data returned from an event, you can create a page script. Use below code to log the event payload to console.
console.log(JSON.stringify(event.payload));
I use this in every page I build to see what an event is returning.
3. In this payload you'll find the record sysId along with other useful data.
Mark my response correct if worked for you. 🙂
ServiceNow Community Rising Star 2022/2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2022 08:35 AM
Hi, this helped me figure it out, thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2023 06:54 AM
in the similar manner do we have any event to get not selected records sys_id ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 03:00 AM
If you'll notice, the event provides us with a lot of useful data.
- If you are selecting few records, then it'd give you records sysId's as well as encoded query. This query you can use to get further details.
- If you are selecting all the records then you won't get record sysId's. You can use encoded query only.
- If you select most of the records and leave a few then yes, you'll get unselected records with encoded query.
ServiceNow Community Rising Star 2022/2023