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.

Report function to return NAME of day of week

Nadia Ebrahim
Tera Contributor

Hi there, I am trying to return the day of week (the name, not an integer) in a report.  Does anyone know how to do this?

3 REPLIES 3

Tsura Andreeva
Mega Sage

if you are using the 'Column' visualization report you can use Day instead of Date in the Calendar

TsuraAndreeva_1-1709649177905.png

 

 

 

Sumanth16
Kilo Patron

Hi @Nadia Ebrahim ,

 

Try to use this in script include (or) create custom field and populate day using below script:

var todayDateTime = new GlideDateTime(gs.nowDateTime());

var integerValForToday = todayDateTime.getDayOfWeekLocalTime();

var jsonObj = '{"1":"Monday","2":"Tuesday","3":"Wednesday","4":"Thursday","5":"Friday","6":"Saturday","7":"Sunday"}';

var parser = new JSONParser();
var parsedData = parser.parse(jsonObj);

var dayOfWeek = parsedData[integerValForToday];

 

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

Thanks very much, Sumanth - can this script be used within a report function field?  See attached screenshot.