Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 01:40 PM
@Austin27 please refer this:
1. Server Script
(function() {
// Get sys_id from the widget parameter
data.sys_id = $sp.getParameter("sys_id");
// Query the widget table for the given sys_id
var widgetGr = new GlideRecord("sp_widget");
widgetGr.addQuery("sys_id", data.sys_id);
widgetGr.query();
if (widgetGr.next()) {
// Retrieve the sys_updated_on field value as a GlideDateTime object
var modifiedTime = widgetGr.getValue("sys_updated_on");
// Convert the GlideDateTime to a formatted string
var gdt = new GlideDateTime(modifiedTime);
data.modifiedTime = gdt.getDate().getByFormat("MMM dd, yyyy HH:mm:ss");
}
})();
2. Client Script
function($scope, $sce) {
var c = this;
// Watch for changes in the data object and trust the HTML content
$scope.$watch('c.data.modifiedTime', function(newValue) {
if (newValue) {
c.modifiedTime_html = $sce.trustAsHtml(newValue);
}
});
}
<p ng-bind-html="c.modifiedTime_html"></p>
…………………………………………........................................................................................
Please Mark it helpful 👍and Accept Solution ✅!! If this helps you to understand.
…………………………………………........................................................................................