Configure function field on report

Alon Grod
Tera Expert

 I have a report on metric_instance table. I want to add a function field that will calculate the duration from the start field of type Date/Time to the current time at the moment. What should i write instead of ‘end’?


I attached image

 

16 REPLIES 16

RobCook86
Tera Expert
var now = new GlideDateTime();

This should give you the current date/time 

Ankur Bawiskar
Tera Patron
Tera Patron

@Alon Grod 

try this if it works

glidefunction:datediff(now(),start);

check this as well

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

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

Its not working

@Alon Grod 

report is on which table/database view? share screenshots

are you using correct field name for start?

It should work provided you used the correct field and correct syntax

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

AnkurBawiskar_0-1747819787962.png

It worked fine for me see below

function field in reporting datediff workaround.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