Creating Function field using glidefunction:datediff()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 06:18 PM
I want to have a column in the list giving how many days back the incident was created without storing it in the database. Therefore, I do not want to create a database column and maintain it all the time. Therefore, I created a Function field on my table.
By doing: using dictionary-> New -> a record with Function Field = Yes
with Function definition as glidefunction:datediff(sys_created_on,now());
Instead of number of days, it is computing 1969-12-31 23-28-34. I guess that there is a mismatch in the format of sys_created and now(). Can someone please suggest what function do I use instead of now().
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2020 08:39 PM
Hi Rakesh,
I am glad to hear your goal has been achieved.
Saying this, I will appreciate if you close this thread, as answered.
Have a great rest of the day
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 04:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 01:49 PM
I know its late, but I think I found the way to do this if you are a sysadmin or can get them to do it for you. First create a report formula and just do the datediff() with any two date fields so you can get it saved initially. The system will auto create a function field on the table named u_rpt_{your function name} (or rpt_your_function)
You can locate this in the table configuration and see the function you wrote in the report builder. I was able to change the actual function and replace the parameters and use the all lowercase now() method and it let me save... and then my report that was using my report function showed the datediff appropriately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2021 10:17 AM
I had my admin create it on the table directly - works great!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2022 01:57 AM