Unique requirement - Can we sort rows in an MRVS in ServiceNow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2025 03:55 AM - edited ‎01-02-2025 04:03 AM
Can we sort rows in an MRVS in ServiceNow?
For example, if the serial number is the first column, how can we ensure that every time we add a new row, it is assigned the next serial number rather than simply being added at the end of the list?
Also, if I have already entered 20 rows and need to insert a new row in the middle of the list, is this possible? 
If we want to add new record at serial number 2, earlier record at serial no. 2 should become 3, 3 --> 4 and so on.
instead adding it to last position.
 
 
 

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2025 07:09 AM
Hello @dharam743
This can be done. You will need to create a widget and add it in the catalog item with custom type variable. Now in the widget, you can add event listener function which will trigger on the field change and in function check if the field name is same as your MRVS variable set name. If yes, then read the MRVS value and you can manipulate the data to have it sorted based on the serial number. then populate the sorted data in MRVS.
Example script for event listener:
Note:
The script would be little complex and also you need to make sure that infinite loop does not happen as the widget reacts to MRVS change and again changes the MRVS value which will intern again change trigger the same script.
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2025 07:13 AM
this is possible. Determine if a new row is added or removed and then determine the next serial number or adjust if a row is removed
check this link on how to determine if row is added/removed and you can enhance the logic as per your requirement
MRVS detect when a row is removed or deleted
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader