
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 06:11 AM
Does anyone know an easy way to always include a particular item as one of the popular items in the service portal widget?
My boss wants a particular thing to show up there (regardless of how many times it was actually requested).
Thanks,
Shannon
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 07:52 AM
Not ideal/best practice - you'll undoubtedly want to change this as some point and having to re-code the widget isn't an ideal way of updating this. Personally and without knowing further details about your use case or environment, I'd lean towards a System Property.
But here's some quick, untested code that you can try in the Server Script of your widget to get a particular catalog item included. Add to about line 5 of the OOB server script just after var items = [];
var sticky = new GlideAggregate('sc_cat_item');
sticky.addQuery('sys_id','[INSERT SYS ID HERE]');
sticky.query();
while (sticky.next()) {
if (!$sp.canReadRecord("sc_cat_item", sticky.sys_id))
continue; // user does not have permission to see this item
var item = {};
item.name = sticky.name.getDisplayValue();
item.short_description = sticky.short_description.getDisplayValue();
item.picture = sticky.picture.getDisplayValue();
item.price = sticky.price.getDisplayValue();
item.sys_id = sticky.sys_id.getDisplayValue();
items.push(item)
}
EDIT: jacob.benker had a good presentation on Data Driven Development (including how to leverage System Properties for use cases like these) in Creator Con breakout session (CCB4208) at Knowledge17 just last week.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 06:25 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 06:53 AM
Yes, that's what I figured, but I'm just not great at coding, so wasn't sure how to do it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 07:32 AM
First thing you need to do is determine how you will mark those "sticky" items that should always be included. Will you add a boolean/checkbox to the Catalog Item (sc_cat_item table) to mark the ones that should be sticky? Or, will you keep track of them using a custom System Property (sys_properties entry) which keeps track of the Sys IDs of the sticky items?
Then, perhaps the community can better help you with updating the widget code once we know more about how you plan on implementing the feature.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 07:38 AM
I figured I could just enter the sys_id. Since it's just one or 2 items, it's not a big deal.