- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 01:22 AM
We have a requirement where we would have to display records from a custom table to a service portal page if the start date/time matches the current time and should not be displayed when the end date/time matches the current time.
Currently, the widget displays all the records from the table.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 03:07 AM
@testingniras if you embedd a standard simpel list into your widget you could do something like this to get the record where start date is in the past and end date is in the future.
<widget id="widget-simple-list" options="data.list" ></widget>
var gdt = new GlideDateTime();
data.list = {
"secondary_fields":"number",
"always_show":"true",
"table":"incident",
"filter":"active=true^u_start_date<=" + gdt +"^u_end_date>" + gdt,
"display_field":"short_description",
"maximum_entries":"5"
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 01:03 AM
HI @testingniras
Can you elaborate with some more information, How is the data presented now, is it a custom built widget or an ootb widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 01:29 AM
Hi @Gustav Aldenbra ,
Yes, it is a custom widget, which is fetching data from a custom table. The Widget uses a simple list instance to which we set the table and filter to draw data into the page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 03:07 AM
@testingniras if you embedd a standard simpel list into your widget you could do something like this to get the record where start date is in the past and end date is in the future.
<widget id="widget-simple-list" options="data.list" ></widget>
var gdt = new GlideDateTime();
data.list = {
"secondary_fields":"number",
"always_show":"true",
"table":"incident",
"filter":"active=true^u_start_date<=" + gdt +"^u_end_date>" + gdt,
"display_field":"short_description",
"maximum_entries":"5"
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 06:46 AM
Thanks @Gustav Aldenbra , This was helpful.