- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2017 09:37 AM
To all experts,
At this moment, many of you could be in K17. But when you get a breather, please help me with the following issue.
The client wants to rearrange the order in the Service Portal Popular Items.
I cloned the widget and modified the server code but it did not get the correct order. Please help and tell me what I missed.
Server Script:
data.sc_catalog = $sp.getValue('sc_catalog');
data.showPrices = $sp.showCatalogPrices();
var items = [];
var count = new GlideAggregate('sc_req_item');
//var count = new GlideRecord('sc_req_item');
//count.addAggregate('COUNT','cat_item');
count.groupBy('cat_item');
count.addQuery('cat_item.sys_class_name', 'NOT IN', 'sc_cat_item_guide,sc_cat_item_wizard,sc_cat_item_content');
count.addQuery('cat_item.sc_catalogs', data.sc_catalog);
//count.orderByAggregate('COUNT', 'cat_item');
count.orderBy('cat_item.order');
count.query();
while (count.next() && items.length < 9) {
if (!$sp.canReadRecord("sc_cat_item", count.cat_item.sys_id.getDisplayValue()))
continue; // user does not have permission to see this item
var item = {};
item.count = count.getAggregate('COUNT', 'cat_item');
item.name = count.cat_item.name.getDisplayValue();
item.short_description = count.cat_item.short_description.getDisplayValue();
item.picture = count.cat_item.picture.getDisplayValue();
item.price = count.cat_item.price.getDisplayValue();
item.sys_id = count.cat_item.sys_id.getDisplayValue();
items.push(item);
}
data.items = items;
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2017 12:14 PM
The client did not want to show the Popular items, so the widget instance was removed. The client accepted the change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2017 12:14 PM
The client did not want to show the Popular items, so the widget instance was removed. The client accepted the change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 10:31 AM
What did you end up replacing it with yltsai?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 10:40 AM
Since the client did not want to display the Popular items, we removed the widget instance. It left a big blank space on the page with a simple Catalog item list on the left.
Thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 10:41 AM
Interesting, thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 09:07 PM
Hello,
I have similar problem like i want to arrange the catalog items in Popular Items Widget according to their access.
That means i want to display the most recently accessed cat item first and then 2nd most recently accessed and so on.
Can anyone help?