Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

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

Tanushree Maiti
Tera Sage

Hi @pathumharsh 

 

Though you do not want to create any new field, still sharing this KB article:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0854574

 

Check this links if it helps you:

https://www.servicenow.com/community/guided-learning-itsm/set-new-password-policy/m-p/3314871

https://www.servicenow.com/community/developer-forum/password-reset-after-xx-days/m-p/1434954/page/2

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: