Reference qualifier with descending order
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 09:51 AM
Hi All,
I am trying to display incident number (reference field) in descending order on catalog item portal view.
I found, it can't be done using variable attribute as there is no parameter to set the order is descending. ref_ac_order_by only order result by user preference.
I tried even with script include , the result on BG is working fine and present incident number on descending order but same result on portal has ascending order.
getIncidentRecord: function(caller)
{
var inc = '';
var gr_incident = new GlideRecord('incident');
gr_incident.addEncodedQuery('caller_id='+caller);
gr_incident.orderByDesc('number');
gr_incident.query();
while(gr_incident.next()) {
inc += (',' + gr_incident.sys_id);
}
return 'sys_idIN' + inc;
}
I don't want to use BR for this purpose as ServiceNow will flooded with so many BR if such requirement comes on future for any other attribute.
Can someone help me here, this seems very common requirement.
Many thanks in advance,
Regards,
Rajeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 02:00 PM
Hello, @rajeevsaraf. Do you see the following option in your instance? This is on version San Diego.
It seems that one can define the order and the direction of a variable's reference list here. However, I cannot get it to work properly, so there may be an issue present in my instance. Perhaps it will work for you?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 12:30 AM
Hello,
Please try this
Javascript:'filter_query^ORDERBYcolumnName';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 06:03 AM
Hello, @Jagadish Sanadi. The original question was about a catalog item variable, not a table column. Unfortunately, your suggestion is not applicable.