Display when there is no data to display in the widget
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2022 09:27 PM
Hello
If there is no data to display in the widget, I would like to display a phrase such as "There is currently no data to display".
Is this possible?
If possible, please tell me how to change it.
Labels:
- Labels:
-
Service Portal
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 01:28 AM

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 01:14 AM
Hi Fujiwara-san,
Like below.
data.notes = [];
var nowtime = new GlideDateTime();
var company = gs.getUser().getCompanyID();
var annGR = new GlideRecord('announcement');
annGR.addQuery('u_announce_type', 'operationalstatus');
annGR.addQuery('active', true);
annGR.addQuery('u_system_name', company).addOrCondition('u_system_name', 'null');
annGR.addQuery('from', '<', nowtime);
annGR.addQuery('to', '>', nowtime).addOrCondition('to', 'null');
annGR.orderByDesc('sys_created_on');
annGR.query();
if (annGR.hasNext()) {
while (annGR.next()) {
var annObj = {};
//use service portal helper method to get some display values
$sp.getRecordDisplayValues(annObj, annGR, 'number,title,sys_id');
//get the first 20 characters of the description
annObj.note = annGR.getValue('summary');
//push the populated obj into the array
data.notes.push(annObj);
}
} else {
data.notes.push('There is currently no data to display');
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2022 01:31 AM