Function Field in Report: Calculate Days Since Last Password Change Using Current Date

pathumharsh
Tera Contributor

Hi all,

I am trying to create a report in ServiceNow that shows the number of days since the last Password change date for each record. I want to calculate:

      Days Since Last Password Change= Current Date – u_last_password_changed

Requirements:

  1. I do not want to add a new field to the table.

  2. I tried using Configure → Function Field in the report.

  3. I attempted the following:

glidefunction:dateDiffDays(u_last_password_changed, today)
glidefunction:dateDiffDays(u_last_password_changed, gs.nowDateTime())

 

…but I keep getting errors:

  • "Function has returned an invalid result"

  • "nowDateTime is not a supported function"

I also tried using the today keyword, but it is not accepted in Function Field.

 

Goal:

  • Calculate days dynamically based on current date

  • Do this without creating a new field on the table

 

1 REPLY 1