Multi row variables sorting in descending order
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi Team,
Need help, regarding Multirow variable set.
I have scenario, in the Multirow variable set "status date" variable should be sorting in descending order. How can we achieve without scripting.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @Madhusagar Pal1 ,
we can achieve with catalog client script.
function onLoad() {
var mrvsName = 'your_mrvs_internal_name';
var mrvsData = JSON.parse(g_form.getValue(mrvsName));
if (mrvsData && mrvsData. length > 0) {
mrvsData.sort(function(a, b) {
var dateA = new Date(a.status_date);
var dateB = new Date(b.status_date);
return dateB - dateA;
});
g_form.setValue(mrvsName, JSON.stringify(mrvsData));
}
}
Chandan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @Madhusagar Pal1 ,
If your MRVS pulls from a data from table
you can achieve this like mentioned below :
1.Open the variable configuration inside the MRVS.
2.Add this under Variable Attributes:
order_by_desc=status_date
Cheers,
Sanjay J.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
38m ago
CHECK THIS: https://www.servicenow.com/community/itsm-forum/sorting-a-multi-row-variable-set/m-p/684225
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
33m ago
when should this run and sort?
On RITM form when variable editor shows MRVS?
OR
As soon as row is added in MRVS during submission?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader