Adding today’s date to a summary template can be easily accomplished using a custom script. The date will maintain the date of the last time the summary view had its data refreshed.
Select the Field Selector chart type.
Choose Custom Chart as the data source and select any table. The table will have no bearing as we are pulling today’s date from ServiceNow and not a table or field.
In the custom script field, paste the script at the bottom of this article
Click Save.
On the chart options panel set the number of rows and the number of columns to 1.
Open the select fields and choose any field, again we are not pulling data from a record or field but simply pulling the date from ServiceNow.
Click Save.
Copy This Entire Script In the Custom Chart Field
To change the date format, the getByFormat on line 2 can be updated to ServiceNow recognized formats by updating the string in the getByFormat method.
The label can be updated on line 8. Simply replace the “As Of” next to “label” with any desired string.
// Beginning of code snippet
var date = new GlideDate();
date.getByFormat("dd-MM-yyyy");
var display = date.getDisplayValue();
var data = {
chartData: [
{
"label": "As Of",
"value": display,
"type": "string",
"tableInfo": "",
"recordInfo": "",
"query": {
"type": "default",
"query": ""
}
}
]
}
chartData = {
data: data,
options: options
};
// End of Code Snippet