Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Function field to calculate Ageing in Report Designer

Piyush Dwivedi
Tera Contributor

How to calculate ageing via function field in Report designer

Ageing calculation is basically a difference between created date and current date

1 ACCEPTED SOLUTION

@Piyush Dwivedi 

that's correct, it won't allow you to write now() but you can go to dictionary and update that script

the 1st screenshot is from the article I shared

sharing again

AnkurBawiskar_0-1751511588422.png

 

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Nishant8
Giga Sage
Giga Sage

Hello @Piyush Dwivedi, you can't do the date calculation in function field directly in Report. However, you can create a function filed in the respective table and select the same while creating the report. 

please use following script in the function field:

glidefunction:datediff(now(),created_date)

 

Regards,

Nishant

I will note this order matters and that there were older postings saying you could not use now() in a function field but it seems you can now (I tested in Xanadu). Created_date field is also typically: sys_created_on

daisyk
Kilo Contributor

Hello,
Calculating "ageing" in a Report Designer typically involves determining the difference between a specific date (e.g., invoice date, created date, last updated date) and a current or reference date. The exact steps and functions will vary depending on the specific Report Designer software you are using (e.g., SAP, ServiceNow,

Ankur Bawiskar
Tera Patron
Tera Patron

@Piyush Dwivedi 

very well explained here

Function Fields in ServiceNow Reports: Calculate and Display Data on the Fly 

Remember you cannot use now() directly but there is a trick to update that field in dictionary

As per the link I shared it says invalid syntax, but there is a workaround for that

AnkurBawiskar_0-1751457432775.png

 

It worked fine for me see below when I used that workaround

AnkurBawiskar_1-1751457434046.gif

 

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader