How to sort the list like newly created records to display first in widget in portal
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 11:11 PM
Hi,
Can anyone help me how to display the list of records in a widget to display newly created records first.
We have a widget and in the script i have to write a syntax to display newly created records on the top.
How can i achieve it?
I tried but its not working. Please help me.
(function() {
var tableName = 'u_table';
var projectId = $sp.getParameter("sysparm_sys_id") || $sp.getParameter("sysparm_projid");
var statusId = $sp.getParameter('sysparm_report_id');
var topQuery = "top_task="+ projectId + "^u_status=Red^closed_atRELATIVEGT@dayofweek@ago@7^ORclosed_atISEMPTY^u_typeINRisk,Issue";
topQuery.orderByDesc("sys_created_on"); /// I ADDED THIS BUT NOT WORKING
data.pending = statusReport.getRisks(topQuery, tableName);
})();
Labels:
- Labels:
-
Scripting and Coding