Calculated Value of Field is Empty on Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 04:11 AM
Hi Experts,
I have created one custom field as Integer which stores only the hour of created field.
Calculate code:
(function calculatedFieldValue(current) {
var date1 = new GlideDateTime(current.getDisplayValue('sys_created_on'));
var g_hours = date1.getTime();
return g_hours.getByFormat('HH');// return the calculated value
})(current);
Above code is giving me required output. Now, the problem is when I use that field in report to show the hours it is giving me empty. And, when I refresh the incidents record it starts reflecting in the list. But, it is only giving me those records which has been refreshed.
Note: Refresh on record here I am doing is, I clicked on list view short description and without updating anything I saved it and it start giving me the records in reports.
Please suggest if I need to refresh records to show in reports for calculated field.
Thanks,
Ankit Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 11:07 PM
Hi @Samaksh Wani, My issue is not resolved yet. The script which you suggested, I already used it before posting this question here. It is mentioned in my query description, unfortunately it did not help me to find solution for my problem.
Regards,
Ankit Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2023 11:14 PM
can you show me the screenshot what output you are getting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 05:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 06:40 AM
Hi @Ankit Singh4 ,
Hope you are doing great.
Try using below syntax to fetch hours of date and set in custom field:
current.sys_created_on.getHourOfDay(); // Return the calculated value
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 10:20 PM