- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2017 01:38 AM
I have had to make some modifications to the approvals widget so instead of showing only the unapproved tickets, I'm having to show the closed ones as well.
What I need to implement is, for instance, if I limit the pool to 10 and if a user has 3 unapproved tickets it will show those at the top followed by the 7 most recent approved tickets. I managed to get the list to sort by the date a ticket was opened by adding gr.orderBy('sys_created_on'); but I want to also filter for 'active' tickets so if a user has any unapproved tickets they will display at the top? I was wondering if this is doable and if someone could shed some light?
var gr = new GlideRecord('sysapproval_approver');
- gr.setLimit(10);
- gr.orderBy('sys_created_on');
Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2017 02:05 AM
Oh!
I see.
You can use the
gr.orderByDesc() multiple times and that way set more than one column to sort by
gr.orderByDesc('column_A')
gr.orderByDesc('column_B')
gr.orderByDesc('column_C')
Guessing that solves you problem right ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2017 02:40 AM
Thanks again, Stewe - that seems to have fixed the issue!!
gr.orderByDesc('state');
gr.orderByDesc('sys_created_on');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2024 03:45 AM
Hi @Stewe Lundin , Good day!
can you suggest me where to add this 'gr.orderByDesc('column_A')' in server script of my tasks widget on ESC portal?
Regards,
Tejaswi G

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2024 04:37 AM
Need a bit more than this to go on but
I would suggest some where in between your
var gr = new GlideRecord('your_table');
and
gr.query();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2024 04:59 AM
But @Stewe Lundin, in the 'HRM To dos Summary' widget they didn't glide 'sysapproval_approver' table at all. How to add this query to that?
I don't want to add sort options to it. Just want to display new approvals on the top followed by old approvals.
Is there any way to achieve this please, let me know.
Here is the server script of the widget which is used by 'My tasks" on ESC Portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2025 12:41 AM
Hello @Tejaswi Gundu ,
Please let me know if you have configured this. I have the same requirement. Can you please help me with this?
Thanks in advance!